Log4perl/st.pm

filter: Statementstmt 13.0% 17 / 130 Branchbran 0.0% 0 / 70 Conditioncond 0.0% 0 / 51 MC/DCmcdc 0.0% 0 / 27 Subroutinesub 21.7% 5 / 23 Podpod 90.0% 9 / 10 totaltotal 9.9% 31 / 311 CC 55 SCAR 56.2
CC
55
Cov
7%
execute
552.0
execute_array
420.0
fetchrow_array
20.0
CRAP 277.1
« Log4perl/db.pm ↑ Summary Log4perl.pm »
1 # $Id: st.pm 284 2006-09-07 13:50:57Z martin $
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Log::Log4perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 package DBIx::Log4perl::st;
8 2 @DBIx::Log4perl::st::ISA = qw(DBI::st DBIx::Log4perl);
9 2 ▶use DBIx::Log4perl::Constants qw (:masks $LogMask);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶sub finish {
Subroutine finish: not called CC=2 SCAR=17.9
Pod documented
12 0 my ($sth) = shift;
13  
14 0 my $h = _unseen_sth($sth);
15  
16 $sth->_dbix_l4p_debug($h, 2,
17 "finish($h->{dbh_no}.$sth->{private_DBIx_st_no})")
18 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_INPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 1 0 0 0
19 0 return $sth->SUPER::finish;
20 }
21  
22 #
23 # NOTE: execute can be called from the DBD. Now we support retrieving
24 # dbms_output from DBD::Oracle we need a flag to say we are in the
25 # 'dbms_output_get' or when we call dbms_output_get we will log a second
26 # execute and potentially recurse until we run out of stack.
27 # We use the "dbd_specific" flag since we may need it for other
28 # drivers in the future and that is the logging flag we implement dbms_output
29 # fetching under
30 #
31 0 ▶sub execute {
Subroutine execute: not called CC=23 SCAR=63.1
Pod documented
32 0 my $sth = shift;
33 0 my $h = $sth->{private_DBIx_Log4perl};
34  
35 0 ▶ if (($h->{logmask} & (DBIX_L4P_LOG_INPUT|DBIX_L4P_LOG_SQL)) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($h->{"logmask"} & 513 and not +(caller) =~ /^DBD::/o and not $h->{"dbd_specific"}) 0 0 0
Condition0%0/6
$h->{"logmask"} & 513 and not +(caller) =~ /^DBD::/o and not $h->{"dbd_specific"}
!ll&&!rl&&r
000
$h->{"logmask"} & 513 and not +(caller) =~ /^DBD::/o
!ll&&!rl&&r
000
MC/DC0%0/3
$h->{"logmask"} & 513 and not +(caller) =~ /^DBD::/o and not $h->{"dbd_specific"}
$h->{"logmask"} & 513 not +(caller) =~ /^DBD::/o not $h->{"dbd_specific"}
Truth table0%0/4
A and not(B) and not(C)
A= $h->{"logmask"} & 513B= not +(caller) =~ /^DBD::/oC= not $h->{"dbd_specific"}
ABCresult
0XX0
10X0
1100
1111
36 (caller !~ /^DBD::/o) &&
37 (!$h->{dbd_specific})) {
38 0 my $params;
39 #if (defined($sth->{ParamValues})) {
40 # $params = '{params => ';
41 # foreach (sort keys %{$sth->{ParamValues}}) {
42 # $params .= "$_=" . DBI::neat($h->{ParamValues}->{$_}) . ",";
43 # }
44 # $params .= '}'; # TO_DO not used yet
45 #}
46 0 ▶ if (scalar(@_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_) { } 0 0 0
47 $sth->_dbix_l4p_debug(
48 $h, 2,
49 "execute($h->{dbh_no}.$sth->{private_DBIx_st_no}) (" .
50 0 ▶ ($sth->{Statement} ? $sth->{Statement} : '') . ')', @_);
Branch: 1 branch
BranchTrueFalseTotal
$sth->{'Statement'} ? : 0 0 0
51 } else {
52 0 my @param_info;
53 push @param_info, $sth->{ParamValues}, $sth->{ParamTypes}
54 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_DELAYBINDPARAM);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 256 0 0 0
55 0 $sth->_dbix_l4p_debug(
56 $h, 2,
57 "execute($h->{dbh_no}.$sth->{private_DBIx_st_no})",
58 @param_info);
59 }
60 }
61  
62 0 my $ret = $sth->SUPER::execute(@_);
63  
64 #
65 # If DBDSPECIFIC is enabled and this is DBD::Oracle we will attempt to
66 # to retrieve any dbms_output. However, 'dbms_output_get' actually
67 # creates a new statement, prepares it, executes it, binds parameters
68 # and then fetches the dbms_output. This will cause this execute method
69 # to be called again and we could recurse forever. To prevent that
70 # happening we set {dbd_specific} flag before calling dbms_output_get
71 # and clear it afterwards.
72 #
73 # Also in DBI (at least up to 1.54) and most DBDs, the same memory is
74 # used for a dbh errstr/err/state and each statement under it. As a
75 # result, if you sth1->execute (it fails) then $sth2->execute which
76 # succeeds, sth1->errstr/err are undeffed :-(
77 # see http://www.nntp.perl.org/group/perl.dbi.users/2007/02/msg30971.html
78 # To sort this out, we save the errstr/err/state on the first sth
79 # and put them back after using the second sth (ensuring we temporarily
80 # turn off any error handler to avoid set_err calling them again).
81 #
82 0 ▶ if (($h->{logger}->is_debug()) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($h->{"logger"}->is_debug and $h->{"logmask"} & 128 and $h->{"driver"} eq "Oracle" and not $h->{"dbd_specific"}) 0 0 0
Condition0%0/9
$h->{"logger"}->is_debug and $h->{"logmask"} & 128 and $h->{"driver"} eq "Oracle" and not $h->{"dbd_specific"}
!ll&&!rl&&r
000
$h->{"logger"}->is_debug and $h->{"logmask"} & 128 and $h->{"driver"} eq "Oracle"
!ll&&!rl&&r
000
$h->{"logger"}->is_debug and $h->{"logmask"} & 128
!ll&&!rl&&r
000
MC/DC0%0/4
$h->{"logger"}->is_debug and $h->{"logmask"} & 128 and $h->{"driver"} eq "Oracle" and not $h->{"dbd_specific"}
$h->{"logger"}->is_debug $h->{"logmask"} & 128 $h->{"driver"} eq "Oracle" not $h->{"dbd_specific"}
Truth table0%0/5
A and B and C and not(D)
A= $h->{"logger"}->is_debugB= $h->{"logmask"} & 128C= $h->{"driver"} eq "Oracle"D= not $h->{"dbd_specific"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
83 ($h->{logmask} & DBIX_L4P_LOG_DBDSPECIFIC) &&
84 ($h->{driver} eq 'Oracle') && (!$h->{dbd_specific})) {
85  
86 0 my ($errstr, $err, $state) = (
87 $sth->errstr, $sth->err, $sth->state);
88 0 $h->{dbd_specific} = 1;
89 0 my $dbh = $sth->FETCH('Database');
90  
91 0 my @lines = $dbh->func('dbms_output_get');
92 0 ▶ $sth->_dbix_l4p_debug($h, 2, 'dbms', @lines) if (scalar(@lines) > 0);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @lines > 0 0 0 0
93 0 $h->{dbd_specific} = 0;
94 {
95 0 local $sth->{HandleError} = undef;
96 0 local $sth->{HandleSetErr} = undef;
97 0 $sth->set_err($err, $errstr, $state);
98 }
99 }
100  
101 0 ▶ if (!$ret) { # error
Branch: 2 branches
BranchTrueFalseTotal
if (not $ret) { } 0 0 0
elsif (defined $ret and not $h->{'dbd_specific'}) { } 0 0 0
102 0 ▶ if (($h->{logmask} & DBIX_L4P_LOG_ERRCAPTURE) && # logging errors
Branch: 1 branch
BranchTrueFalseTotal
if ($h->{"logmask"} & 16 and not +(caller) =~ /^DBD::/o) 0 0 0
Condition0%0/3
$h->{"logmask"} & 16 and not +(caller) =~ /^DBD::/o
!ll&&!rl&&r
000
MC/DC0%0/2
$h->{"logmask"} & 16 and not +(caller) =~ /^DBD::/o
$h->{"logmask"} & 16 not +(caller) =~ /^DBD::/o
Truth table0%0/3
A and not(B)
A= $h->{"logmask"} & 16B= not +(caller) =~ /^DBD::/o
ABresult
0X0
100
111
103 (caller !~ /^DBD::/o)) { # ! called from DBD e.g. execute_array
104 0 ▶ if ((exists($h->{err_regexp}) && ($sth->err !~ $h->{err_regexp})) ||
Branch: 1 branch
BranchTrueFalseTotal
if (exists $h->{"err_regexp"} and not $sth->err =~ /$h->{"err_regexp"}/ or not exists $h->{"err_regexp"}) 0 0 0
Condition0%0/6
exists $h->{"err_regexp"} and not $sth->err =~ /$h->{"err_regexp"}/ or not exists $h->{"err_regexp"}
l!l&&r!l&&!r
000
exists $h->{"err_regexp"} and not $sth->err =~ /$h->{"err_regexp"}/
!ll&&!rl&&r
000
MC/DC0%0/3
exists $h->{"err_regexp"} and not $sth->err =~ /$h->{"err_regexp"}/ or not exists $h->{"err_regexp"}
exists $h->{"err_regexp"} not $sth->err =~ /$h->{"err_regexp"}/ not exists $h->{"err_regexp"}
Truth table0%0/5
A and not(B) or not(C)
A= exists $h->{"err_regexp"}B= not $sth->err =~ /$h->{"err_regexp"}/C= not exists $h->{"err_regexp"}
ABCresult
11X1
0X11
1011
0X00
1000
105 (!exists($h->{err_regexp}))) {
106 0 $sth->_dbix_l4p_error(
107 2, "\tfailed with " . DBI::neat($sth->errstr));
108 }
109 }
110 ▶ } elsif (defined($ret) && (!$h->{dbd_specific})) {
Condition0%0/3
defined $ret and not $h->{"dbd_specific"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ret and not $h->{"dbd_specific"}
defined $ret not $h->{"dbd_specific"}
Truth table0%0/3
A and not(B)
A= defined $retB= not $h->{"dbd_specific"}
ABresult
0X0
100
111
111 $sth->_dbix_l4p_debug(
112 $h, 2, "affected($h->{dbh_no}.$sth->{private_DBIx_st_no})", $ret)
113 if ((!defined($sth->{NUM_OF_FIELDS})) && # not a result-set
114 0 ▶ ($h->{logmask} & DBIX_L4P_LOG_INPUT) && # logging input
Branch: 1 branch
BranchTrueFalseTotal
if not defined $sth->{"NUM_OF_FIELDS"} and $h->{"logmask"} & 1 and not +(caller) =~ /^DBD::/o 0 0 0
Condition0%0/6
not defined $sth->{"NUM_OF_FIELDS"} and $h->{"logmask"} & 1 and not +(caller) =~ /^DBD::/o
!ll&&!rl&&r
000
not defined $sth->{"NUM_OF_FIELDS"} and $h->{"logmask"} & 1
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $sth->{"NUM_OF_FIELDS"} and $h->{"logmask"} & 1 and not +(caller) =~ /^DBD::/o
not defined $sth->{"NUM_OF_FIELDS"} $h->{"logmask"} & 1 not +(caller) =~ /^DBD::/o
Truth table0%0/4
not(A) and B and not(C)
A= not defined $sth->{"NUM_OF_FIELDS"}B= $h->{"logmask"} & 1C= not +(caller) =~ /^DBD::/o
ABCresult
0XX0
10X0
1100
1111
115 (caller !~ /^DBD::/o));
116 }
117 0 return $ret;
118 }
119  
120 0 ▶sub execute_array {
Subroutine execute_array: not called CC=20 SCAR=60.4
Pod documented
121 0 my ($sth, @args) = @_;
122 0 my $h = $sth->{private_DBIx_Log4perl};
123  
124 $sth->_dbix_l4p_debug($h, 2,
125 "execute_array($h->{dbh_no}.$sth->{private_DBIx_st_no})", @args)
126 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_INPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 1 0 0 0
127  
128 0 ▶ if (($#args >= 0) && ($args[0]) &&
Branch: 2 branches
BranchTrueFalseTotal
if ($#args >= 0 and $args[0] and ref $args[0] eq 'HASH' and not exists $args[0]{'ArrayTupleStatus'}) { } 0 0 0
elsif (not $args[0]) { } 0 0 0
Condition0%0/9
$#args >= 0 and $args[0] and ref $args[0] eq "HASH" and not exists $args[0]{"ArrayTupleStatus"}
!ll&&!rl&&r
000
$#args >= 0 and $args[0] and ref $args[0] eq "HASH"
!ll&&!rl&&r
000
$#args >= 0 and $args[0]
!ll&&!rl&&r
000
MC/DC0%0/4
$#args >= 0 and $args[0] and ref $args[0] eq "HASH" and not exists $args[0]{"ArrayTupleStatus"}
$#args >= 0 $args[0] ref $args[0] eq "HASH" not exists $args[0]{"ArrayTupleStatus"}
Truth table0%0/5
A and B and C and not(D)
A= $#args >= 0B= $args[0]C= ref $args[0] eq "HASH"D= not exists $args[0]{"ArrayTupleStatus"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
129 (ref($args[0]) eq 'HASH') &&
130 (!exists($args[0]->{ArrayTupleStatus}))) {
131 0 $args[0]->{ArrayTupleStatus} = \my @tuple_status;
132 } elsif (!$args[0]) {
133 0 $args[0] = {ArrayTupleStatus => \my @tuple_status};
134 }
135 0 my $array_tuple_status = $args[0]->{ArrayTupleStatus};
136  
137 #
138 # NOTE: We have a problem here. The DBI pod stipulates that
139 # execute_array returns undef (for error) or the number of tuples
140 # executed. If we want to access the number of rows updated or
141 # inserted then we need to add up the values in the ArrayTupleStatus.
142 # Unfortunately, the drivers which implement execute_array themselves
143 # (e.g. DBD::Oracle) don't do this properly (e.g. DBD::Oracle 1.18a).
144 # As a result, until this is sorted out, our logging of execute_array
145 # may be less than accurate.
146 # NOTE: DBD::Oracle 1.19 is working now from my supplied patch
147 #
148 0 my ($executed, $affected) = $sth->SUPER::execute_array(@args);
149 0 ▶ if (!$executed) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $executed) { } 0 0 0
elsif ($executed) { } 0 0 0
150 #print Data::Dumper->Dump([$sth->{ParamArrays}], ['ParamArrays']), "\n";
151 0 ▶ if (!$h->{logmask} & DBIX_L4P_LOG_ERRORS) {
Branch: 1 branch
BranchTrueFalseTotal
if (!$h->{"logmask"} & 64) 0 0 0
152 0 ▶ return $executed unless wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 0 0
153 0 return ($executed, $affected);
154 }
155 0 my $pa = $sth->{ParamArrays};
156 0 $sth->_dbix_l4p_error(2, "execute_array error:");
157 0 for my $n (0..@{$array_tuple_status}-1) {
158 0 ▶ next if (!ref($array_tuple_status->[$n]));
Branch: 1 branch
BranchTrueFalseTotal
unless ref $array_tuple_status->[$n] 0 0 0
159 0 $sth->_dbix_l4p_error('Error', $array_tuple_status->[$n]);
160 0 my @plist;
161 0 foreach my $p (keys %{$pa}) {
162 0 ▶ if (ref($pa->{$p})) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $pa->{$p}) { } 0 0 0
163 0 push @plist, $pa->{$p}->[$n];
164 } else {
165 0 push @plist, $pa->{$p};
166 }
167 }
168 $sth->_dbix_l4p_error(
169 0 ▶ 2, sub {"\t for " . join(',', map(DBI::neat($_), @plist))});
Subroutine __ANON__: not called CC=1 SCAR=6.9
170 }
171 } elsif ($executed) {
172 0 ▶ if ((defined($sth->{NUM_OF_FIELDS})) || # result-set
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sth->{"NUM_OF_FIELDS"} or not $h->{"logmask"} & 1) 0 0 0
Condition0%0/3
defined $sth->{"NUM_OF_FIELDS"} or not $h->{"logmask"} & 1
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $sth->{"NUM_OF_FIELDS"} or not $h->{"logmask"} & 1
defined $sth->{"NUM_OF_FIELDS"} not $h->{"logmask"} & 1
Truth table0%0/3
A or not(B)
A= defined $sth->{"NUM_OF_FIELDS"}B= not $h->{"logmask"} & 1
ABresult
1X1
011
000
173 !($h->{logmask} & DBIX_L4P_LOG_INPUT)) { # logging input
174 0 ▶ return $executed unless wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 0 0
175 0 return ($executed, $affected);
176 }
177 0 $sth->_dbix_l4p_debug($h, 2, "executed $executed, affected " .
178 DBI::neat($affected));
179 }
180 0 ▶ $sth->_dbix_l4p_debug($h, 2, sub {Data::Dumper->Dump(
Subroutine __ANON__: not called CC=1 SCAR=6.9
181 [$array_tuple_status], ['ArrayTupleStatus'])})
182 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_INPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 1 0 0 0
183 0 ▶ return $executed unless wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 0 0
184 0 return ($executed, $affected);
185 }
186  
187 0 ▶sub bind_param {
Subroutine bind_param: not called CC=3 SCAR=24.8
Pod documented
188 0 my $sth = shift;
189  
190 0 my $h = $sth->{private_DBIx_Log4perl};
191  
192 $sth->_dbix_l4p_debug(
193 $h, 2, "bind_param($h->{dbh_no}.$sth->{private_DBIx_st_no})", @_)
194 if (($h->{logmask} & DBIX_L4P_LOG_INPUT) &&
195 0 ▶ (($h->{logmask} & DBIX_L4P_LOG_DELAYBINDPARAM) == 0));
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 1 and ($h->{"logmask"} & 256) == 0 0 0 0
Condition0%0/3
$h->{"logmask"} & 1 and ($h->{"logmask"} & 256) == 0
!ll&&!rl&&r
000
MC/DC0%0/2
$h->{"logmask"} & 1 and ($h->{"logmask"} & 256) == 0
$h->{"logmask"} & 1 ($h->{"logmask"} & 256) == 0
Truth table0%0/3
A and B
A= $h->{"logmask"} & 1B= ($h->{"logmask"} & 256) == 0
ABresult
0X0
100
111
196  
197 0 return $sth->SUPER::bind_param(@_);
198 }
199  
200 0 ▶sub bind_param_inout {
Subroutine bind_param_inout: not called CC=3 SCAR=24.8
Pod documented
201 0 my $sth = shift;
202 0 my $h = $sth->{private_DBIx_Log4perl};
203  
204 $sth->_dbix_l4p_debug(
205 $h, 2,
206 "bind_param_inout($h->{dbh_no}.$sth->{private_DBIx_st_no})", @_)
207 0 ▶ if (($h->{logmask} & DBIX_L4P_LOG_INPUT) && (caller !~ /^DBD::/o));
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 1 and not +(caller) =~ /^DBD::/o 0 0 0
Condition0%0/3
$h->{"logmask"} & 1 and not +(caller) =~ /^DBD::/o
!ll&&!rl&&r
000
MC/DC0%0/2
$h->{"logmask"} & 1 and not +(caller) =~ /^DBD::/o
$h->{"logmask"} & 1 not +(caller) =~ /^DBD::/o
Truth table0%0/3
A and not(B)
A= $h->{"logmask"} & 1B= not +(caller) =~ /^DBD::/o
ABresult
0X0
100
111
208 0 return $sth->SUPER::bind_param_inout(@_);
209 }
210  
211 0 ▶sub bind_param_array {
Subroutine bind_param_array: not called CC=2 SCAR=17.9
Pod documented
212 0 my($sth, @args) = @_;
213 0 my $h = $sth->{private_DBIx_Log4perl};
214  
215 $sth->_dbix_l4p_debug($h, 2,
216 "bind_param_array($h->{dbh_no}.$sth->{private_DBIx_st_no})",
217 0 ▶ @args) if ($h->{logmask} & DBIX_L4P_LOG_INPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 1 0 0 0
218 0 return $sth->SUPER::bind_param_array(@args);
219 }
220  
221 0 ▶sub fetch { # alias for fetchrow_arrayref
Subroutine fetch: not called CC=2 SCAR=17.9
Pod undocumented
222 0 my($sth, @args) = @_;
223  
224 0 my $h = _unseen_sth($sth);
225  
226 0 my $res = $sth->SUPER::fetch(@args);
227 $sth->_dbix_l4p_debug($h, 2,
228 0 ▶ sub {Data::Dumper->Dump(
Subroutine __ANON__: not called CC=1 SCAR=6.9
229 [$res], ["fetch($h->{dbh_no}.$sth->{private_DBIx_st_no})"])})
230 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_OUTPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 2 0 0 0
231 0 return $res;
232 }
233  
234 0 ▶sub fetchrow_arrayref { # alias for fetchrow_arrayref
Subroutine fetchrow_arrayref: not called CC=2 SCAR=17.9
Pod documented
235 0 my($sth, @args) = @_;
236  
237 0 my $h =_unseen_sth($sth);
238  
239 0 my $res = $sth->SUPER::fetchrow_arrayref(@args);
240 $sth->_dbix_l4p_debug($h, 2,
241 0 ▶ sub {Data::Dumper->Dump(
Subroutine __ANON__: not called CC=1 SCAR=6.9
242 [$res],
243 ["fetchrow_arrayref($h->{dbh_no}.$sth->{private_DBIx_st_no})"])})
244 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_OUTPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 2 0 0 0
245 0 return $res;
246 }
247  
248 0 ▶sub fetchrow_array {
Subroutine fetchrow_array: not called CC=4 SCAR=30.0
Pod documented
249 0 my ($sth, @args) = @_;
250  
251 0 my $h = _unseen_sth($sth);
252  
253 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
254 0 my @row = $sth->SUPER::fetchrow_array(@args);
255 $sth->_dbix_l4p_debug($h, 2,
256 0 ▶ sub {Data::Dumper->Dump(
Subroutine __ANON__: not called CC=1 SCAR=6.9
257 [\@row],
258 ["fetchrow_array($h->{dbh_no}.$sth->{private_DBIx_st_no})"])})
259 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_OUTPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 2 0 0 0
260 0 return @row;
261 } else {
262 0 my $row = $sth->SUPER::fetchrow_array(@args);
263 $sth->_dbix_l4p_debug($h, 2,
264 0 ▶ sub {Data::Dumper->Dump(
Subroutine __ANON__: not called CC=1 SCAR=6.9
265 [$row],
266 ["fetchrow_array($h->{dbh_no}.$sth->{private_DBIx_st_no})"])})
267 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_OUTPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 2 0 0 0
268 0 return $row;
269 }
270 }
271  
272 0 ▶sub fetchrow_hashref {
Subroutine fetchrow_hashref: not called CC=2 SCAR=17.9
Pod documented
273 0 my($sth, @args) = @_;
274  
275 0 my $h = _unseen_sth($sth);
276  
277 0 my $res = $sth->SUPER::fetchrow_hashref(@args);
278 $sth->_dbix_l4p_debug($h, 2,
279 0 ▶ sub {Data::Dumper->Dump(
Subroutine __ANON__: not called CC=1 SCAR=6.9
280 [$res],
281 ["fetchrow_hashref($h->{dbh_no}.$sth->{private_DBIx_st_no})"])})
282 0 ▶ if ($h->{logmask} & DBIX_L4P_LOG_OUTPUT);
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"logmask"} & 2 0 0 0
283 0 return $res;
284 }
285  
286 #
287 # _unseen_sth is called when we might come across a statement handle which was
288 # not created via the prepare method e.g., a statement handle DBD::Oracle
289 # magicked into existence when a function or procedure returns a cursor.
290 # We need to save the private log handle and set the statement number.
291 #
292 sub _unseen_sth
293 0 ▶{
Subroutine _unseen_sth: not called CC=2 SCAR=17.9
294 0 my $sth = shift;
295  
296 0 ▶ if (!exists($sth->{private_DBIx_Log4perl})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $sth->{'private_DBIx_Log4perl'}) { } 0 0 0
297 0 my $p = $sth->FETCH('Database')->{private_DBIx_Log4perl};
298 0 $sth->{private_DBIx_Log4perl} = $p;
299 0 $sth->{private_DBIx_st_no} = $p->{new_stmt_no}();
300 0 return $p;
301 } else {
302 0 return $sth->{private_DBIx_Log4perl};
303 }
304 }
305  
306 2 1;
« Log4perl/db.pm ↑ Summary Log4perl.pm »