blib/lib/DBM/Deep/Iterator/DBI.pm

filter: Statementstmt 43.4% 10 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 46.8% 15 / 32 CC 2 SCAR 10.4
CC
2
Cov
40%
get_next_key
6.0
reset
2.0
BEGIN
1.0
CRAP 2.8
« blib/lib/DBM/Deep/Sector/DBI/Scalar.pm ↑ Summary blib/lib/DBM/Deep/Hash.pm »
1 package DBM::Deep::Iterator::DBI;
2  
3 48 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 48 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 48 ▶use base qw( DBM::Deep::Iterator );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub reset {
9 0 ▶ my $self = shift;
Subroutine reset: not called CC=1 SCAR=6.9
Pod documented
10  
11 0 eval { $self->{sth}->finish; };
12 0 delete $self->{sth};
13  
14 0 return;
15 }
16  
17 sub get_next_key {
18 0 ▶ my $self = shift;
Subroutine get_next_key: not called CC=2 SCAR=17.9
Pod documented
19 0 my ($obj) = @_;
20  
21 0 ▶ unless ( exists $self->{sth} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"sth"}) 0 0 0
22 # For mysql, this needs to be RAND()
23 # For sqlite, this needs to be random()
24 0 my $storage = $self->{engine}->storage;
25 $self->{sth} = $storage->{dbh}->prepare(
26 0 "SELECT `key` FROM datas WHERE ref_id = ? ORDER BY "
27 . $storage->rand_function,
28 );
29 0 $self->{sth}->execute( $self->{base_offset} );
30 }
31  
32 0 my ($key) = $self->{sth}->fetchrow_array;
33 0 return $key;
34 }
35  
36 48 1;
37 __END__
« blib/lib/DBM/Deep/Sector/DBI/Scalar.pm ↑ Summary blib/lib/DBM/Deep/Hash.pm »