line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
106
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ package DBIx::Wrapper::SelectLoop; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
12
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
192
|
|
18
|
|
|
|
|
|
|
$VERSION = do { my @r=(q$Revision: 1963 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r }; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
12
|
use base 'DBIx::Wrapper::Statement'; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
1510
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
0
|
|
|
0
|
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
|
|
0
|
|
|
|
bless $self, ref($proto) || $proto; |
29
|
0
|
|
|
|
|
|
$self->_setParent($parent); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my ($sth, $rv, $r); |
32
|
0
|
0
|
|
|
|
|
if (scalar(@_) == 4) { |
33
|
0
|
|
|
|
|
|
($sth, $rv, $r) = $parent->_getStatementHandleForQuery($query, $exec_args); |
34
|
|
|
|
|
|
|
} else { |
35
|
0
|
|
|
|
|
|
($sth, $rv, $r) = $parent->_getStatementHandleForQuery($query); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
return $sth unless $sth; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->_setSth($sth); |
41
|
0
|
|
|
|
|
|
$self->_setRequestObj($r); |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub next { |
47
|
0
|
|
|
0
|
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
|
|
|
|
|
|
|
sub nextWithArrayRef { |
65
|
0
|
|
|
0
|
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
|
0
|
|
|
|
|
return [ @$row ] if $row; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return undef; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
*nextArrayRef = \&nextWithArrayRef; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub rowCountCurrent { |
86
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
87
|
0
|
|
|
|
|
|
return $$self{_cur_row_count}; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub rowCountTotal { |
91
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
92
|
0
|
|
|
|
|
|
my $sth = $self->_getSth; |
93
|
0
|
|
|
|
|
|
return $sth->rows; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
*count = \&rowCountTotal; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub DESTROY { |
98
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
99
|
0
|
|
|
|
|
|
my $sth = $self->_getSth; |
100
|
0
|
0
|
|
|
|
|
$sth->finish if $sth; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|