Fast/Result.pm

filter: Statementstmt 54.2% 32 / 59 Branchbran 35.7% 5 / 14 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 50.0% 5 / 10 Podpod 85.7% 6 / 7 totaltotal 53.6% 51 / 95 CC 9 SCAR 15.3
CC
9
Cov
51%
array
12.0
all
6.0
flat
6.0
CRAP 4.6
« Fast/Profiler.pm ↑ Summary Fast/Cached.pm »
1 package DBIx::Fast::Result;
2  
3 34 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 34 ▶use Object::Pad 0.807;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 34 our $VERSION = '0.20';
7  
8 class DBIx::Fast::Result {
9  
10 0 ▶ field $sth :param :reader;
Subroutine sth: not called CC=1 SCAR=2.6
Pod undocumented
11 0 field $count :reader = 0;
12  
13 0 ▶ method hash () {
Subroutine count: not called CC=1 SCAR=0.1
Subroutine hash: called CC=3 SCAR=11.1
Pod documented
Pod documented
14 3 ▶ return undef unless $sth; # prepare failed under RaiseError => 0
Branch: 1 branch
BranchTrueFalseTotal
unless $sth 1 2 3
15 2 my $row = $sth->fetchrow_hashref;
16 2 ▶ $count++ if $row;
Branch: 1 branch
BranchTrueFalseTotal
if $row 2 0 2
17 2 return $row;
18 34 }
19
20 0 ▶ method array () {
Subroutine array: not called CC=3 SCAR=24.8
Pod documented
21 0 ▶ return unless $sth; # prepare failed under RaiseError => 0
Branch: 1 branch
BranchTrueFalseTotal
unless $sth 0 0 0
22 0 my @row = $sth->fetchrow_array;
23 0 ▶ return unless @row;
Branch: 1 branch
BranchTrueFalseTotal
unless @row 0 0 0
24 0 $count++;
25 0 return \@row;
26 34 }
27
28 0 ▶ method all () {
Subroutine all: not called CC=2 SCAR=17.9
Pod documented
29 0 ▶ return [] unless $sth; # prepare failed under RaiseError => 0
Branch: 1 branch
BranchTrueFalseTotal
unless $sth 0 0 0
30 0 my $rows = $sth->fetchall_arrayref({});
31 0 $count += scalar @$rows;
32 0 return $rows;
33 34 }
34
35 0 ▶ method flat () {
Subroutine flat: not called CC=2 SCAR=17.9
Pod documented
36 0 ▶ return [] unless $sth; # prepare failed under RaiseError => 0
Branch: 1 branch
BranchTrueFalseTotal
unless $sth 0 0 0
37 # fetchall_arrayref([0]) loops in DBI's C path - much faster than a
38 # per-row Perl fetch on large result sets.
39 0 my $col = $sth->fetchall_arrayref([0]);
40 0 $count += scalar @$col;
41 0 return [ map { $_->[0] } @$col ];
42 34 }
43
44 2 ▶ method finish () {
Subroutine finish: called CC=3 SCAR=11.0
Pod documented
45 # eval: an iterator can outlive its connection (disconnect, reconnect);
46 # asking a statement of a closed handle for Active is an error then.
47 2 ▶ $sth->finish if $sth && eval { $sth->FETCH('Active') };
Branch: 1 branch
BranchTrueFalseTotal
if $sth and eval { do { $sth->FETCH("Active") } } 1 1 2
Condition66%2/3
$sth and eval { do { $sth->FETCH("Active") } }
!ll&&!rl&&r
101
MC/DC50%1/2
$sth and eval { do { $sth->FETCH("Active") } }
$sth eval { do { $sth->FETCH("Active") } }
Truth table66%2/3
A and B
A= $sthB= eval { do { $sth->FETCH("Active") } }
ABresult
0X0
100
111
48 34 }
49
50 2 ▶ method DESTROY () {
Subroutine DESTROY: called CC=1 SCAR=0.0
51 2 $self->finish;
52 34 }
53  
54 }
55  
56 34 1;
57  
58 __END__
« Fast/Profiler.pm ↑ Summary Fast/Cached.pm »