| 1 | package DBIO::Storage::DBI::Cursor; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Object representing a query cursor on a resultset. | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 302 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 302 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 302 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 302 | ▶ | use base 'DBIO::Cursor'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 302 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 302 | ▶ | use Scalar::Util qw(refaddr weaken); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 302 | ▶ | use DBIO::Util qw(has_ithreads is_windows shuffle_unordered_resultsets); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 302 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 302 | __PACKAGE__->mk_group_accessors('simple' => | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | qw/storage args attrs/ | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 302 | my %cursor_registry; | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my ($class, $storage, $args, $attrs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my $self = bless { | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | storage => $storage, | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | args => $args, | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | attrs => $attrs, | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | }, ref $class || $class; | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if (has_ithreads) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # quick "garbage collection" pass - prevents the registry | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # from slowly growing with a bunch of undef-valued keys | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | defined $cursor_registry{$_} or delete $cursor_registry{$_} | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | for keys %cursor_registry; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | weaken( $cursor_registry{ refaddr($self) } = $self ) | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub CLONE { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | for (keys %cursor_registry) { | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | # once marked we no longer care about them, hence no | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # need to keep in the registry, left alone renumber the | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # keys (all addresses are now different) | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $self = delete $cursor_registry{$_} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | or next; | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $self->{_intra_thread} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 302 | ▶ | sub next { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: not called CC=13 SCAR=51.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | return if $self->{_done}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $sth; | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/8
$self->{"attrs"}{"software_limit"} and $self->{"attrs"}{"rows"} and ($self->{"_pos"} || 0) >= $self->{"attrs"}{"rows"}
$self->{"attrs"}{"software_limit"} and $self->{"attrs"}{"rows"}
$self->{'_pos'} || 0
MC/DC0%0/3
$self->{"attrs"}{"software_limit"} and $self->{"attrs"}{"rows"} and ($self->{"_pos"} || 0) >= $self->{"attrs"}{"rows"}
$self->{"attrs"}{"software_limit"}
$self->{"attrs"}{"rows"}
$self->{'_pos'}
Truth table0%0/4
A and B and C
A= $self->{"attrs"}{"software_limit"}B= $self->{"attrs"}{"rows"}C= $self->{'_pos'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | $self->{attrs}{software_limit} | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | && $self->{attrs}{rows} | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | && ($self->{_pos}||0) >= $self->{attrs}{rows} | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ($sth = $self->sth) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # explicit finish will issue warnings, unlike the DESTROY below | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | $sth->finish if $sth->FETCH('Active'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->{_done} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | unless ($sth = $self->sth) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | (undef, $sth, undef) = $self->storage->_select( @{$self->{args}} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $self->{_results} = [ (undef) x $sth->FETCH('NUM_OF_FIELDS') ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $sth->bind_columns( \( @{$self->{_results}} ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if ( $self->{attrs}{software_limit} and $self->{attrs}{offset} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"attrs"}{"software_limit"} and $self->{"attrs"}{"offset"}
MC/DC0%0/2
$self->{"attrs"}{"software_limit"} and $self->{"attrs"}{"offset"}
$self->{"attrs"}{"software_limit"}
$self->{"attrs"}{"offset"}
Truth table0%0/3
A and B
A= $self->{"attrs"}{"software_limit"}B= $self->{"attrs"}{"offset"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $sth->fetch for 1 .. $self->{attrs}{offset}; | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $self->sth($sth); | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if ($sth->fetch) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $self->{_pos}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return @{$self->{_results}}; | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->{_done} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub all { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
all: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # delegate to DBIC::Cursor which will delegate back to next() | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ($self->{attrs}{software_limit} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"attrs"}{"software_limit"} and $self->{"attrs"}{"offset"} || $self->{"attrs"}{"rows"}
$self->{"attrs"}{"offset"} or $self->{"attrs"}{"rows"}
MC/DC0%0/3
$self->{"attrs"}{"software_limit"} and $self->{"attrs"}{"offset"} || $self->{"attrs"}{"rows"}
$self->{"attrs"}{"software_limit"}
$self->{"attrs"}{"offset"}
$self->{"attrs"}{"rows"}
Truth table0%0/4
A and B or C
A= $self->{"attrs"}{"software_limit"}B= $self->{"attrs"}{"offset"}C= $self->{"attrs"}{"rows"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | && ($self->{attrs}{offset} || $self->{attrs}{rows})) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | return $self->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $sth; | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | if ($sth = $self->sth) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # explicit finish will issue warnings, unlike the DESTROY below | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | $sth->finish if ( ! $self->{_done} and $sth->FETCH('Active') ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->{"_done"} and $sth->FETCH("Active")
MC/DC0%0/2
not $self->{"_done"} and $sth->FETCH("Active")
not $self->{"_done"}
$sth->FETCH("Active")
Truth table0%0/3
not(A) and B
A= not $self->{"_done"}B= $sth->FETCH("Active")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $self->sth(undef); | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | (undef, $sth) = $self->storage->_select( @{$self->{args}} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | shuffle_unordered_resultsets | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | and | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ! $self->{attrs}{order_by} | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | and | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | require List::Util | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ? List::Util::shuffle( @{$sth->fetchall_arrayref} ) | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | : @{$sth->fetchall_arrayref} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
&shuffle_unordered_resultsets() and not $self->{"attrs"}{"order_by"} and require List::Util
&shuffle_unordered_resultsets() and not $self->{"attrs"}{"order_by"}
MC/DC0%0/3
&shuffle_unordered_resultsets() and not $self->{"attrs"}{"order_by"} and require List::Util
&shuffle_unordered_resultsets()
not $self->{"attrs"}{"order_by"}
require List::Util
Truth table0%0/4
A and not(B) and C
A= &shuffle_unordered_resultsets()B= not $self->{"attrs"}{"order_by"}C= require List::Util
| |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ; | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub is_exhausted { $_[0]->{_done} ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_exhausted: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub position { $_[0]->{_pos} || 0 } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
position: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub mark_exhausted { $_[0]->{_done} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mark_exhausted: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub sth { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sth: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | delete @{$self}{qw/_pos _done _pid _intra_thread/}; | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $self->{sth} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $self->{_pid} = $$ if ! is_windows and $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not &is_windows() and $_[0]
MC/DC0%0/2
not &is_windows() and $_[0]
not &is_windows()
$_[0]
Truth table0%0/3
not(A) and B
A= not &is_windows()B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ▶ | elsif ($self->{sth} and ! $self->{_done}) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"sth"} and not $self->{"_done"}
MC/DC0%0/2
$self->{"sth"} and not $self->{"_done"}
$self->{"sth"}
not $self->{"_done"}
Truth table0%0/3
A and not(B)
A= $self->{"sth"}B= not $self->{"_done"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $invalidate_handle_reason; | |||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if (has_ithreads and $self->{_intra_thread} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
&has_ithreads() and $self->{"_intra_thread"}
MC/DC0%0/2
&has_ithreads() and $self->{"_intra_thread"}
&has_ithreads()
$self->{"_intra_thread"}
Truth table0%0/3
A and B
A= &has_ithreads()B= $self->{"_intra_thread"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $invalidate_handle_reason = 'Multi-thread'; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ▶ | elsif (!is_windows and $self->{_pid} != $$ ) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not &is_windows() and $self->{"_pid"} != $$
MC/DC0%0/2
not &is_windows() and $self->{"_pid"} != $$
not &is_windows()
$self->{"_pid"} != $$
Truth table0%0/3
not(A) and B
A= not &is_windows()B= $self->{"_pid"} != $$
| |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $invalidate_handle_reason = 'Multi-process'; | |||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ($invalidate_handle_reason) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | $self->storage->throw_exception("$invalidate_handle_reason access attempted while cursor in progress (position $self->{_pos})") | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | if $self->{_pos}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # reinvokes the reset logic above | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->sth(undef); | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | return $self->{sth}; | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | $_[0]->__finish_sth if $_[0]->{sth}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $_[0]->sth(undef); | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | $_[0]->__finish_sth if $_[0]->{sth}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub __finish_sth { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__finish_sth: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # It is (sadly) extremely important to finish() handles we are about | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # to lose (due to reset() or a DESTROY() ). $rs->reset is the closest | ||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # thing the user has to getting to the underlying finish() API and some | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # DBDs mandate this (e.g. DBD::InterBase will segfault, DBD::Sybase | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # won't start a transaction sanely, etc) | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # We also can't use the accessor here, as it will trigger a fork/thread | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # check, and resetting a cursor in a child is perfectly valid | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # No need to care about failures here | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | try { local $SIG{__WARN__} = sub {}; $self->{sth}->finish } if ( | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $self->{sth} and ! try { ! $self->{sth}->FETCH('Active') } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"sth"} and not &try(sub {
not $self->{"sth"}->FETCH("Active");
}
)
MC/DC0%0/2
$self->{"sth"} and not &try(sub {
not $self->{"sth"}->FETCH("Active");
}
)
$self->{"sth"}
not &try(sub {
not $self->{"sth"}->FETCH("Active");
}
)
Truth table0%0/3
A and not(B)
A= $self->{"sth"}B= not &try(sub {
not $self->{"sth"}->FETCH("Active");
}
)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 302 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||