| 1 | # -*-perl-*- | ||||||||||||||||||||
| 2 | # Creation date: 2003-03-30 15:25:00 | ||||||||||||||||||||
| 3 | # Authors: Don | ||||||||||||||||||||
| 4 | # Change log: | ||||||||||||||||||||
| 5 | # $Revision: 1963 $ | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # Copyright (c) 2003-2012 Don Owens | ||||||||||||||||||||
| 8 | # | ||||||||||||||||||||
| 9 | # All rights reserved. This program is free software; you can | ||||||||||||||||||||
| 10 | # redistribute it and/or modify it under the same terms as Perl | ||||||||||||||||||||
| 11 | # itself. | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | { package DBIx::Wrapper::SelectLoop; | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 2 | ▶ | use vars qw($VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 2 | $VERSION = do { my @r=(q$Revision: 1963 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r }; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 2 | ▶ | use base 'DBIx::Wrapper::Statement'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 23 | 0 | my ($proto, $parent, $query, $exec_args) = @_; | |||||||||||||||||||
| 24 | 0 | my $self = { _query => $query, _exec_args => $exec_args, | |||||||||||||||||||
| 25 | _cur_row_count => 0 | ||||||||||||||||||||
| 26 | }; | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | ▶ | bless $self, ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 29 | 0 | $self->_setParent($parent); | |||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 0 | my ($sth, $rv, $r); | |||||||||||||||||||
| 32 | 0 | ▶ | if (scalar(@_) == 4) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | 0 | ($sth, $rv, $r) = $parent->_getStatementHandleForQuery($query, $exec_args); | |||||||||||||||||||
| 34 | } else { | ||||||||||||||||||||
| 35 | 0 | ($sth, $rv, $r) = $parent->_getStatementHandleForQuery($query); | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | return $sth unless $sth; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | $self->_setSth($sth); | |||||||||||||||||||
| 41 | 0 | $self->_setRequestObj($r); | |||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 0 | return $self; | |||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub next { | ||||||||||||||||||
|
Subroutine
next: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 47 | 0 | my ($self) = @_; | |||||||||||||||||||
| 48 | 0 | my $sth = $self->_getSth; | |||||||||||||||||||
| 49 | 0 | $self->{_cur_row_count}++; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | my $r = $self->_getRequestObj; | |||||||||||||||||||
| 52 | 0 | $self->_getParent()->_runPreFetchHook($r); | |||||||||||||||||||
| 53 | 0 | $sth = $r->getStatementHandle; | |||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 0 | my $result = $sth->fetchrow_hashref($self->_getParent()->getNameArg); | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 0 | $r->setReturnVal($result); | |||||||||||||||||||
| 58 | 0 | $self->_getParent()->_runPostFetchHook($r); | |||||||||||||||||||
| 59 | 0 | $result = $r->getReturnVal; | |||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 0 | return $result; | |||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 0 | ▶ | sub nextWithArrayRef { | ||||||||||||||||||
|
Subroutine
nextWithArrayRef: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 65 | 0 | my ($self) = @_; | |||||||||||||||||||
| 66 | 0 | my $sth = $self->_getSth; | |||||||||||||||||||
| 67 | 0 | $self->{_cur_row_count}++; | |||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 0 | my $r = $self->_getRequestObj; | |||||||||||||||||||
| 70 | 0 | $self->_getParent()->_runPreFetchHook($r); | |||||||||||||||||||
| 71 | 0 | $sth = $r->getStatementHandle; | |||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 0 | my $row = $sth->fetchrow_arrayref; | |||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 0 | $r->setReturnVal($row); | |||||||||||||||||||
| 76 | 0 | $self->_getParent()->_runPostFetchHook($r); | |||||||||||||||||||
| 77 | 0 | $row = $r->getReturnVal; | |||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | 0 | ▶ | return [ @$row ] if $row; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | 0 | return undef; | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | 2 | *nextArrayRef = \&nextWithArrayRef; | |||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 0 | ▶ | sub rowCountCurrent { | ||||||||||||||||||
|
Subroutine
rowCountCurrent: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 86 | 0 | my ($self) = @_; | |||||||||||||||||||
| 87 | 0 | return $$self{_cur_row_count}; | |||||||||||||||||||
| 88 | } | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | 0 | ▶ | sub rowCountTotal { | ||||||||||||||||||
|
Subroutine
rowCountTotal: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 91 | 0 | my ($self) = @_; | |||||||||||||||||||
| 92 | 0 | my $sth = $self->_getSth; | |||||||||||||||||||
| 93 | 0 | return $sth->rows; | |||||||||||||||||||
| 94 | } | ||||||||||||||||||||
| 95 | 2 | *count = \&rowCountTotal; | |||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 98 | 0 | my ($self) = @_; | |||||||||||||||||||
| 99 | 0 | my $sth = $self->_getSth; | |||||||||||||||||||
| 100 | 0 | ▶ | $sth->finish if $sth; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 101 | } | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | } | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | 2 | 1; | |||||||||||||||||||
| 107 | |||||||||||||||||||||