line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
package DBIx::DataModel::Statement::JDBC; |
3
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
4
|
7
|
|
|
7
|
|
1181
|
use strict; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
221
|
|
5
|
7
|
|
|
7
|
|
39
|
use warnings; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
211
|
|
6
|
7
|
|
|
7
|
|
35
|
no strict 'refs'; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
204
|
|
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
50
|
use parent qw/DBIx::DataModel::Statement/; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
60
|
|
9
|
7
|
|
|
7
|
|
495
|
use mro qw/c3/; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
35
|
|
10
|
7
|
|
|
7
|
|
241
|
use DBI qw/SQL_INTEGER/; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
4867
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# methods on the JDBC ResultSet object, without argument |
13
|
|
|
|
|
|
|
foreach my $method (qw/size getRow |
14
|
|
|
|
|
|
|
getMemberCount getSQLStatement |
15
|
|
|
|
|
|
|
beforeFirst afterLast |
16
|
|
|
|
|
|
|
isBeforeFirst isAfterLast/) { |
17
|
|
|
|
|
|
|
*{$method} = sub { |
18
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
19
|
0
|
0
|
|
|
|
|
$self->execute() if !$self->{sth}; |
20
|
0
|
|
|
|
|
|
$self->{sth}->jdbc_func("ResultSet.$method"); |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# methods on the JDBC ResultSet object, with an INT argument |
25
|
|
|
|
|
|
|
foreach my $method (qw/relative absolute/) { |
26
|
|
|
|
|
|
|
*{$method} = sub { |
27
|
0
|
|
|
0
|
|
|
my ($self, $int_arg) = @_; |
28
|
0
|
0
|
|
|
|
|
$self->execute() if !$self->{sth}; |
29
|
0
|
|
|
|
|
|
$self->{sth}->jdbc_func([$int_arg => SQL_INTEGER], "ResultSet.$method"); |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# methods on the JDBC Statement object, with an INT argument |
35
|
|
|
|
|
|
|
foreach my $method (qw/setMaxRows setQueryTimeout/) { |
36
|
|
|
|
|
|
|
*{$method} = sub { |
37
|
0
|
|
|
0
|
|
|
my ($self, $int_arg) = @_; |
38
|
0
|
0
|
|
|
|
|
$self->prepare() if !$self->{sth}; |
39
|
0
|
|
|
|
|
|
$self->{sth}->jdbc_func([$int_arg => SQL_INTEGER], "Statement.$method"); |
40
|
|
|
|
|
|
|
}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub sqlize { |
44
|
0
|
|
|
0
|
0
|
|
my ($self, @args) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# merge new args into $self->{args} |
47
|
0
|
0
|
|
|
|
|
$self->refine(@args) if @args; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# remove -limit and -offset from args; they will be handled later in |
50
|
|
|
|
|
|
|
# prepare() and execute(), see below |
51
|
0
|
|
|
|
|
|
$self->{jdbc_limit} = delete $self->{args}{-limit}; |
52
|
0
|
|
0
|
|
|
|
$self->{offset} = delete $self->{args}{-offset} || 0; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->next::method(); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub prepare { |
59
|
0
|
|
|
0
|
0
|
|
my ($self, @args) = @_; |
60
|
0
|
|
|
|
|
|
$self->next::method(@args); |
61
|
0
|
|
|
|
|
|
my $limit = $self->{jdbc_limit}; |
62
|
0
|
0
|
|
|
|
|
$self->setMaxRows($limit + $self->{offset}) if $limit; |
63
|
0
|
|
|
|
|
|
return $self; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub execute { |
67
|
0
|
|
|
0
|
0
|
|
my ($self, @args) = @_; |
68
|
0
|
|
|
|
|
|
$self->next::method(@args); |
69
|
0
|
0
|
|
|
|
|
$self->absolute($self->{offset}) if $self->{offset}; |
70
|
0
|
|
|
|
|
|
return $self; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub row_count { |
74
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
75
|
0
|
0
|
|
|
|
|
$self->{row_count} = $self->getMemberCount unless exists $self->{row_count}; |
76
|
0
|
|
|
|
|
|
return $self->{row_count}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |