QueryByName/Result/HashIterator.pm

filter: Statementstmt 57.5% 19 / 33 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 53.0% 26 / 49 CC 6 SCAR 30.7
CC
6
Cov
46%
next
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 21.5
« QueryByName/QueryPool.pm ↑ Summary QueryByName/Result/ScalarIterator.pm »
1 package DBIx::QueryByName::Result::HashIterator;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use DBIx::QueryByName::Logger qw(get_logger);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use base qw( DBIx::QueryByName::Result::Iterator );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub next {
Subroutine next: not called CC=6 SCAR=37.4
Pod documented
10 0 my $self = shift;
11  
12 0 my @columns = @_;
13  
14 return undef
15 0 ▶ if (!defined $self->{sth});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"sth"} 0 0 0
16  
17 0 ▶ if (my $hash = $self->{sth}->fetchrow_hashref()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $hash = $self->{"sth"}->fetchrow_hashref) 0 0 0
18  
19 0 ▶ return $hash
Branch: 1 branch
BranchTrueFalseTotal
if scalar @columns == 0 0 0 0
20 if (scalar @columns == 0);
21  
22 0 my @values;
23 0 foreach my $c (@columns) {
24 0 ▶ if (exists $hash->{$c}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{$c}) { } 0 0 0
25 0 push @values, $hash->{$c};
26 } else {
27 0 $self->_finish_and_croak("query ".$self->{query}." does not return any value named $c");
28 }
29 }
30  
31 0 return @values;
32 }
33  
34 # no more rows to fetch.
35 # TODO: handle specially if it was an error?
36 0 $self->{sth}->finish();
37 0 $self->{sth} = undef;
38 0 return undef;
39 }
40  
41 1 1;
42  
43 __END__
« QueryByName/QueryPool.pm ↑ Summary QueryByName/Result/ScalarIterator.pm »