LogAny/st.pm

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