line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Connection::Oracle::PLSQL; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3396
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Abstract::Meta::Class ':all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
180
|
|
7
|
1
|
|
|
1
|
|
6
|
use Carp 'confess'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
8
|
1
|
|
|
1
|
|
7
|
use base qw(DBIx::PLSQLHandler); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
103
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
334
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = 0.02; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
DBIx::Connection::Oracle::PLSQL - PLSQL block handler |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use DBIx::PLSQLHandler; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $plsql_handler = new DBIx::PLSQLHandler( |
24
|
|
|
|
|
|
|
name => 'test_proc', |
25
|
|
|
|
|
|
|
connection => $connection, |
26
|
|
|
|
|
|
|
plsql => " |
27
|
|
|
|
|
|
|
DECLARE |
28
|
|
|
|
|
|
|
var1 INT; |
29
|
|
|
|
|
|
|
BEGIN |
30
|
|
|
|
|
|
|
var1 := :var2 + :var3; |
31
|
|
|
|
|
|
|
END;", |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
$plsql_handler->execute(var2 => 12, var3 => 8); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
or |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use DBIx::Connection; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $plsql_handler = $connection->plsql_handler( |
41
|
|
|
|
|
|
|
name => 'test_proc', |
42
|
|
|
|
|
|
|
connection => $connection, |
43
|
|
|
|
|
|
|
plsql => " |
44
|
|
|
|
|
|
|
DECLARE |
45
|
|
|
|
|
|
|
var1 INT; |
46
|
|
|
|
|
|
|
BEGIN |
47
|
|
|
|
|
|
|
:var1 := :var2 + :var3; |
48
|
|
|
|
|
|
|
END;", |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $result_set = $plsql_handler->execute(var2 => 12, var3 => 8); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 methods |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item prepare |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Prepares plsql cursor |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub prepare { |
65
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
66
|
0
|
|
|
|
|
|
$self->set_sql($self->plsql); |
67
|
0
|
|
|
|
|
|
$self->SUPER::prepare(); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item execute |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub execute { |
77
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
78
|
0
|
|
|
|
|
|
my $result_set = $self->bind_parameters(@_); |
79
|
0
|
|
|
|
|
|
$self->SUPER::execute(); |
80
|
0
|
|
|
|
|
|
$result_set; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item bind_parameters |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub bind_parameters { |
89
|
0
|
|
|
0
|
1
|
|
my ($self, %bind_parameters) = @_; |
90
|
0
|
|
|
|
|
|
my $bind_variables = $self->bind_variables; |
91
|
0
|
|
|
|
|
|
my @bind_in_variables = $self->bind_in_variables; |
92
|
0
|
|
|
|
|
|
my %bind_params = (map {$_ => $bind_parameters{$_}} @bind_in_variables); |
|
0
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
my @binded_out_variables = $self->binded_out_variables; |
94
|
0
|
|
|
|
|
|
my %bind_params_inout = (map {$_ => $bind_parameters{$_}} @binded_out_variables); |
|
0
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$self->bind_params(\%bind_params); |
96
|
0
|
|
|
|
|
|
$self->bind_params_inout(\%bind_params_inout); |
97
|
0
|
|
|
|
|
|
\%bind_params_inout; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |