line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*-perl-*- |
2
|
|
|
|
|
|
|
# Creation date: 2004-04-21 10:45:30 |
3
|
|
|
|
|
|
|
# Authors: Don |
4
|
|
|
|
|
|
|
# Change log: |
5
|
|
|
|
|
|
|
# $Revision: 1963 $ |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Copyright (c) 2004-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
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
94
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ package DBIx::Wrapper::SelectExecLoop; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
28
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
176
|
|
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
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1742
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
0
|
|
|
0
|
0
|
|
my ($proto, $parent, $query, $multi) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $r = DBIx::Wrapper::Request->new($parent); |
26
|
0
|
|
|
|
|
|
$r->setQuery($query); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$parent->_runPrePrepareHook($r); |
29
|
0
|
|
|
|
|
|
$query = $r->getQuery; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $sth = $parent->_getDatabaseHandle()->prepare($query); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$r->setStatementHandle($sth); |
34
|
0
|
|
|
|
|
|
$parent->_runPostPrepareHook($r); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$r->setStatementHandle($sth); |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
unless ($sth) { |
39
|
0
|
|
|
|
|
|
$parent->_printDbiError("\nQuery was '$query'\n"); |
40
|
0
|
|
|
|
|
|
return $parent->setErr(0, $DBI::errstr); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
0
|
|
|
|
my $self = |
|
|
|
0
|
|
|
|
|
44
|
|
|
|
|
|
|
bless { _query => $query, _multi => $multi || '' }, ref($proto) || $proto; |
45
|
0
|
|
|
|
|
|
$self->_setSth($sth); |
46
|
0
|
|
|
|
|
|
$self->_setParent($parent); |
47
|
0
|
|
|
|
|
|
$self->_setQuery($query); |
48
|
0
|
|
|
|
|
|
$self->_setRequestObj($r); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub next { |
54
|
0
|
|
|
0
|
0
|
|
my ($self, $exec_args) = @_; |
55
|
0
|
|
|
|
|
|
my $query = $self->_getQuery; |
56
|
0
|
|
|
|
|
|
my $sth = $self->_getSth; |
57
|
0
|
|
|
|
|
|
my $r = $self->_getRequestObj; |
58
|
0
|
|
|
|
|
|
$r->setExecArgs($exec_args); |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
if ($$self{_multi}) { |
61
|
0
|
|
|
|
|
|
$self->_getParent()->_runPreExecHook($r); |
62
|
0
|
|
|
|
|
|
$exec_args = $r->getExecArgs; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $rv = $sth->execute(@$exec_args); |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$r->setExecReturnValue($rv); |
67
|
0
|
|
|
|
|
|
$self->_getParent()->_runPostExecHook($r); |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->_getParent()->_runPreFetchHook($r); |
70
|
0
|
|
|
|
|
|
$sth = $r->getStatementHandle; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if ($rv) { |
73
|
0
|
|
|
|
|
|
my $rows = []; |
74
|
0
|
|
|
|
|
|
my $row = $sth->fetchrow_hashref($self->_getParent()->getNameArg); |
75
|
0
|
|
|
|
|
|
while ($row) { |
76
|
0
|
|
|
|
|
|
$r->setReturnVal($row); |
77
|
0
|
|
|
|
|
|
$self->_getParent()->_runPostFetchHook($r); |
78
|
0
|
|
|
|
|
|
$row = $r->getReturnVal; |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
push @$rows, $row if $row; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$self->_getParent()->_runPreFetchHook($r); |
83
|
0
|
|
|
|
|
|
$sth = $r->getStatementHandle; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$row = $sth->fetchrow_hashref($self->_getParent()->getNameArg); |
86
|
|
|
|
|
|
|
} |
87
|
0
|
|
|
|
|
|
return $rows; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} else { |
91
|
0
|
|
|
|
|
|
$self->_getParent()->_runPreExecHook($r); |
92
|
0
|
|
|
|
|
|
$exec_args = $r->getExecArgs; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $rv = $sth->execute(@$exec_args); |
95
|
0
|
|
|
|
|
|
$r->setExecReturnValue($rv); |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
$self->_getParent()->_runPostExecHook($r); |
98
|
0
|
0
|
|
|
|
|
if ($rv) { |
99
|
0
|
|
|
|
|
|
$self->_getParent()->_runPreFetchHook($r); |
100
|
0
|
|
|
|
|
|
$sth = $r->getStatementHandle; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my $result = $sth->fetchrow_hashref($self->_getParent()->getNameArg); |
103
|
0
|
|
|
|
|
|
$r->setReturnVal($result); |
104
|
0
|
|
|
|
|
|
$self->_getParent()->_runPostFetchHook($r); |
105
|
0
|
|
|
|
|
|
$result = $r->getReturnVal; |
106
|
0
|
|
|
|
|
|
return $result; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
0
|
|
|
|
|
|
return undef; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub DESTROY { |
113
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
114
|
0
|
|
|
|
|
|
my $sth = $self->_getSth; |
115
|
0
|
0
|
|
|
|
|
$sth->finish if $sth; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|