Fast/Result.pm

filter: Statementstmt 25.0% 16 / 64 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 20.0% 2 / 10 Podpod 85.7% 6 / 7 totaltotal 22.2% 24 / 108 CC 12 SCAR 25.6
CC
12
Cov
18%
all
30.0
array
12.0
finish
12.0
CRAP 12.9
« Fast/Transaction.pm ↑ Summary Fast/Test/Mock.pm »
1 package DBIx::Fast::Result;
2  
3 35 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 35 ▶use Object::Pad 0.807;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 35 our $VERSION = '0.21';
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=4.1
Subroutine hash: not called CC=3 SCAR=23.1
Pod documented
Pod documented
14 0 ▶ return undef unless $sth; # prepare failed under RaiseError => 0
Branch: 1 branch
BranchTrueFalseTotal
unless $sth 0 0 0
15 0 my $row = $sth->fetchrow_hashref;
16 0 ▶ $count++ if $row;
Branch: 1 branch
BranchTrueFalseTotal
if $row 0 0 0
17 0 return $row;
18 35 }
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 35 }
27
28 0 ▶ method all () {
Subroutine all: not called CC=5 SCAR=34.0
Pod documented
29 0 ▶ return [] unless $sth; # prepare failed under RaiseError => 0
Branch: 1 branch
BranchTrueFalseTotal
unless $sth 0 0 0
30 # Same hashes as fetchall_arrayref({}), built from the driver's C fetchall
31 # (see DBIx::Fast::SQL::_shape_rows).
32 0 ▶ my $names = $sth->FETCH($sth->FETCH('FetchHashKeyName') || 'NAME');
Condition0%0/2
$sth->FETCH('FetchHashKeyName') || 'NAME'
l!l
00
MC/DC0%0/1
$sth->FETCH('FetchHashKeyName') || 'NAME'
$sth->FETCH('FetchHashKeyName')
Truth table0%0/2
A
A= $sth->FETCH('FetchHashKeyName')
Aresult
11
00
33 my $rows = $names
34 0 ▶ ? [ map { my %h; @h{@$names} = @$_; \%h } @{ $sth->fetchall_arrayref // [] } ]
Branch: 1 branch
BranchTrueFalseTotal
$names ? : 0 0 0
Condition0%0/2
$sth->fetchall_arrayref // []
l!l
00
MC/DC0%0/1
$sth->fetchall_arrayref // []
$sth->fetchall_arrayref
Truth table0%0/2
A
A= $sth->fetchall_arrayref
Aresult
11
00
35 : $sth->fetchall_arrayref({});
36 0 $count += scalar @$rows;
37 0 return $rows;
38 35 }
39
40 0 ▶ method flat () {
Subroutine flat: not called CC=2 SCAR=17.9
Pod documented
41 0 ▶ return [] unless $sth; # prepare failed under RaiseError => 0
Branch: 1 branch
BranchTrueFalseTotal
unless $sth 0 0 0
42 # fetchall_arrayref([0]) loops in DBI's C path - much faster than a
43 # per-row Perl fetch on large result sets.
44 0 my $col = $sth->fetchall_arrayref([0]);
45 0 $count += scalar @$col;
46 0 return [ map { $_->[0] } @$col ];
47 35 }
48
49 0 ▶ method finish () {
Subroutine finish: not called CC=3 SCAR=24.8
Pod documented
50 # eval: an iterator can outlive its connection (disconnect, reconnect);
51 # asking a statement of a closed handle for Active is an error then.
52 0 ▶ $sth->finish if $sth && eval { $sth->FETCH('Active') };
Branch: 1 branch
BranchTrueFalseTotal
if $sth and eval { do { $sth->FETCH("Active") } } 0 0 0
Condition0%0/3
$sth and eval { do { $sth->FETCH("Active") } }
!ll&&!rl&&r
000
MC/DC0%0/2
$sth and eval { do { $sth->FETCH("Active") } }
$sth eval { do { $sth->FETCH("Active") } }
Truth table0%0/3
A and B
A= $sthB= eval { do { $sth->FETCH("Active") } }
ABresult
0X0
100
111
53 35 }
54
55 0 ▶ method DESTROY () {
Subroutine DESTROY: not called CC=1 SCAR=6.9
56 0 $self->finish;
57 35 }
58  
59 }
60  
61 35 1;
62  
63 __END__
« Fast/Transaction.pm ↑ Summary Fast/Test/Mock.pm »