line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Anansi::Database::Oracle; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Anansi::Database::Oracle - A manager for Oracle databases. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Anansi::Database::Oracle; |
11
|
|
|
|
|
|
|
if(Anansi::Database::Oracle->validate( |
12
|
|
|
|
|
|
|
undef, |
13
|
|
|
|
|
|
|
DRIVER => 'Oracle', |
14
|
|
|
|
|
|
|
)) { |
15
|
|
|
|
|
|
|
my $OBJECT = Anansi::Database::Oracle->new(); |
16
|
|
|
|
|
|
|
if($OBJECT->connect( |
17
|
|
|
|
|
|
|
undef, |
18
|
|
|
|
|
|
|
DATABASE => 'someDatabase', |
19
|
|
|
|
|
|
|
PASSWORD => 'somePassword', |
20
|
|
|
|
|
|
|
USERNAME => 'someUser', |
21
|
|
|
|
|
|
|
)) { |
22
|
|
|
|
|
|
|
my $records = $OBJECT->statement( |
23
|
|
|
|
|
|
|
undef, |
24
|
|
|
|
|
|
|
INPUT => [ |
25
|
|
|
|
|
|
|
{ |
26
|
|
|
|
|
|
|
DEFAULT => '0', |
27
|
|
|
|
|
|
|
NAME => 'yetAnotherField', |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
], |
30
|
|
|
|
|
|
|
SQL => 'SELECT some_field, another_field FROM some_table WHERE yet_another_field = ?;', |
31
|
|
|
|
|
|
|
yetAnotherField => 123, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
$OBJECT->disconnect(); |
34
|
|
|
|
|
|
|
if(defined($records)) { |
35
|
|
|
|
|
|
|
if(ref($records) =~ /^ARRAY$/i) { |
36
|
|
|
|
|
|
|
my $record = 0; |
37
|
|
|
|
|
|
|
foreach my $record (@{$records}) { |
38
|
|
|
|
|
|
|
next if(ref($record) !~ /^HASH$/i); |
39
|
|
|
|
|
|
|
print "\n" if(0 < $record); |
40
|
|
|
|
|
|
|
my $field = 0; |
41
|
|
|
|
|
|
|
foreach my $key (keys(%{$record})) { |
42
|
|
|
|
|
|
|
print ', ' if(0 < $field); |
43
|
|
|
|
|
|
|
print '"'.$key.'" = "'.${record}{$key}.'"'; |
44
|
|
|
|
|
|
|
$field++; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
$record++; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
print "\n"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use Anansi::Database; |
55
|
|
|
|
|
|
|
my $OBJECT = Anansi::Database->new(); |
56
|
|
|
|
|
|
|
my $component = $OBJECT->addComponent( |
57
|
|
|
|
|
|
|
undef, |
58
|
|
|
|
|
|
|
DRIVER => 'Oracle', |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
if(defined($component)) { |
61
|
|
|
|
|
|
|
if($OBJECT->channel( |
62
|
|
|
|
|
|
|
'CONNECT', |
63
|
|
|
|
|
|
|
$component, |
64
|
|
|
|
|
|
|
DATABASE => 'someDatabase', |
65
|
|
|
|
|
|
|
PASSWORD => 'somePassword', |
66
|
|
|
|
|
|
|
USERNAME => 'someUser', |
67
|
|
|
|
|
|
|
)) { |
68
|
|
|
|
|
|
|
my $records = $OBJECT->channel( |
69
|
|
|
|
|
|
|
'STATEMENT', |
70
|
|
|
|
|
|
|
$component, |
71
|
|
|
|
|
|
|
INPUT => [ |
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
DEFAULT => '0', |
74
|
|
|
|
|
|
|
NAME => 'yetAnotherField', |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
], |
77
|
|
|
|
|
|
|
SQL => 'SELECT some_field, another_field FROM some_table WHERE yet_another_field = ?;', |
78
|
|
|
|
|
|
|
yetAnotherField => 123, |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
if(defined($records)) { |
81
|
|
|
|
|
|
|
if(ref($records) =~ /^ARRAY$/i) { |
82
|
|
|
|
|
|
|
my $record = 0; |
83
|
|
|
|
|
|
|
foreach my $record (@{$records}) { |
84
|
|
|
|
|
|
|
next if(ref($record) !~ /^HASH$/i); |
85
|
|
|
|
|
|
|
print "\n" if(0 < $record); |
86
|
|
|
|
|
|
|
my $field = 0; |
87
|
|
|
|
|
|
|
foreach my $key (keys(%{$record})) { |
88
|
|
|
|
|
|
|
print ', ' if(0 < $field); |
89
|
|
|
|
|
|
|
print '"'.$key.'" = "'.${record}{$key}.'"'; |
90
|
|
|
|
|
|
|
$field++; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
$record++; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
print "\n"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 DESCRIPTION |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Manages Oracle databases allowing the opening and closing of Oracle databases. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
108
|
|
|
|
|
|
|
|
109
|
1
|
|
|
1
|
|
19878
|
use base qw(Anansi::DatabaseComponent); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1056
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 METHODS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 Anansi::Class |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
See L for details. A parent module of L. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head3 DESTROY |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
See L for details. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head3 finalise |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
See L for details. Overridden by L. A virtual method. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head3 implicate |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
See L for details. A virtual method. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head3 import |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
See L for details. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head3 initialise |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
See L for details. Overridden by L. A virtual method. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head3 new |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
See L for details. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head3 old |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
See L for details. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head3 used |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
See L for details. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head3 uses |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
See L for details. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=cut |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head3 using |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
See L for details. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 Anansi::Component |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
See L for details. A parent module of L. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head3 Anansi::Class |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
See L for details. A parent module of L. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=cut |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head3 addChannel |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
See L for details. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=cut |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head3 channel |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
See L for details. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head3 componentManagers |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
See L for details. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head3 removeChannel |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
See L for details. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 Anansi::DatabaseComponent |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
See L for details. A parent module of L. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head3 Anansi::Component |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
See L for details. A parent module of L. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=cut |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head3 autoCommit |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
See L for details. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=cut |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'AUTOCOMMIT' => 'Anansi::DatabaseComponent::autocommit'); |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head3 bind |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
See L for details. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=cut |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head3 binding |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
See L for details. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=cut |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head3 commit |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
See L for details. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=cut |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'COMMIT' => 'Anansi::DatabaseComponent::commit'); |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=head3 connect |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
See L for details. Overridden by L. |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=cut |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head3 disconnect |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
See L for details. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'DISCONNECT' => 'Anansi::DatabaseComponent::disconnect'); |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head3 finalise |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
See L for details. Overrides L. A virtual method. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head3 finish |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
See L for details. |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=cut |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'FINISH' => 'Anansi::DatabaseComponent::finish'); |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=head3 handle |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
See L for details. |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=cut |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'HANDLE' => 'Anansi::DatabaseComponent::handle'); |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=head3 initialise |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
See L for details. Overrides L. A virtual method. |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=cut |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=head3 prepare |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
See L for details. |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=cut |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'PREPARE' => 'Anansi::DatabaseComponent::prepare'); |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=head3 rollback |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
See L for details. |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=cut |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'ROLLBACK' => 'Anansi::DatabaseComponent::rollback'); |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=head3 statement |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
See L for details. |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=cut |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'STATEMENT' => 'Anansi::DatabaseComponent::statement'); |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=head3 validate |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
See L for details. Overridden by L. |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=cut |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=head2 connect |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
if(Anansi::Database::Oracle::connect( |
375
|
|
|
|
|
|
|
$OBJECT, |
376
|
|
|
|
|
|
|
undef, |
377
|
|
|
|
|
|
|
DATABASE => 'someDatabase', |
378
|
|
|
|
|
|
|
PASSWORD => 'somePassword', |
379
|
|
|
|
|
|
|
USERNAME => 'someUser', |
380
|
|
|
|
|
|
|
)); |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
if($OBJECT->connect( |
383
|
|
|
|
|
|
|
undef, |
384
|
|
|
|
|
|
|
DATABASE => 'someDatabase', |
385
|
|
|
|
|
|
|
PASSWORD => 'somePassword', |
386
|
|
|
|
|
|
|
USERNAME => 'someUser', |
387
|
|
|
|
|
|
|
)); |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=over 4 |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=item self I<(Blessed Hash, Required)> |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
An object of this namespace. |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=item channel I<(String, Required)> |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
The abstract identifier of a subroutine. |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=item parameters I<(Hash, Optional)> |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
Named parameters. |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=over 4 |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=item AutoCommit I<(String, Optional)> |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
Defines whether the Oracle driver automatically saves any changes made to the |
408
|
|
|
|
|
|
|
B. A value of B<1> I<(one)> means changes will be saved, a value of |
409
|
|
|
|
|
|
|
B<0> I<(zero)> means changes will need to be manually saved. Changes are not |
410
|
|
|
|
|
|
|
saved by default. |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=item DATABASE I<(String, Optional)> |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
The name of the Oracle database. The content of the I environment |
415
|
|
|
|
|
|
|
variable is used by default. |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=item HOSTNAME I<(String, Optional)> |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
The IP address of the computer where the Oracle B is hosted. A value |
420
|
|
|
|
|
|
|
of B<127.0.0.1> is used by default. |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=item PASSWORD I<(String, Optional)> |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
The password of the B that is accessing the Oracle database. A value |
425
|
|
|
|
|
|
|
of B is used by default. |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=item PORT I<(String, Optional)> |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
The IP address port number of the computer where the Oracle B is |
430
|
|
|
|
|
|
|
hosted. A value of B<1521> I<(one five two one)> is used by default. |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=item PrintError I<(String, Optional)> |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
Defines whether the Oracle driver will use the B function. A value of B<1> |
435
|
|
|
|
|
|
|
I<(one)> means errors will be output using B, a value of B<0> I<(zero)> |
436
|
|
|
|
|
|
|
means errors will not be output in this way. Errors are output by default. |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
=item RaiseError I<(String, Optional)> |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
Defines whether the Oracle driver will use the B function. A value of B<1> |
441
|
|
|
|
|
|
|
I<(one)> means errors will be output using B, a value of B<0> I<(zero)> |
442
|
|
|
|
|
|
|
means errors will not be output in this way. Errors are output by default. |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=item USERNAME I<(String, Optional)> |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
The user that is accessing the Oracle database. A value of B is used by |
447
|
|
|
|
|
|
|
default. |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=back |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=back |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Overrides L. |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=cut |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
sub connect { |
459
|
0
|
|
|
0
|
1
|
|
my ($self, $channel, %parameters) = @_; |
460
|
0
|
|
0
|
|
|
|
return $self->SUPER::connect( |
461
|
|
|
|
|
|
|
undef, |
462
|
|
|
|
|
|
|
INPUT => [ |
463
|
|
|
|
|
|
|
{ |
464
|
|
|
|
|
|
|
INPUT => [ |
465
|
|
|
|
|
|
|
'dbi:Oracle:host=', { |
466
|
|
|
|
|
|
|
DEFAULT => '127.0.0.1', |
467
|
|
|
|
|
|
|
NAME => 'HOST', |
468
|
|
|
|
|
|
|
REF => '', |
469
|
|
|
|
|
|
|
}, |
470
|
|
|
|
|
|
|
';sid=', { |
471
|
|
|
|
|
|
|
DEFAULT => $ENV{ORACLE_SID} || '', |
472
|
|
|
|
|
|
|
NAME => 'DATABASE', |
473
|
|
|
|
|
|
|
REF => '', |
474
|
|
|
|
|
|
|
}, |
475
|
|
|
|
|
|
|
';port=', { |
476
|
|
|
|
|
|
|
DEFAULT => '1521', |
477
|
|
|
|
|
|
|
NAME => 'PORT', |
478
|
|
|
|
|
|
|
REF => '', |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
], |
481
|
|
|
|
|
|
|
REF => '', |
482
|
|
|
|
|
|
|
}, { |
483
|
|
|
|
|
|
|
NAME => 'USERNAME', |
484
|
|
|
|
|
|
|
REF => '', |
485
|
|
|
|
|
|
|
}, { |
486
|
|
|
|
|
|
|
NAME => 'PASSWORD', |
487
|
|
|
|
|
|
|
REF => '', |
488
|
|
|
|
|
|
|
}, { |
489
|
|
|
|
|
|
|
INPUT => [ |
490
|
|
|
|
|
|
|
{ |
491
|
|
|
|
|
|
|
DEFAULT => 0, |
492
|
|
|
|
|
|
|
NAME => 'AutoCommit', |
493
|
|
|
|
|
|
|
REF => '', |
494
|
|
|
|
|
|
|
}, { |
495
|
|
|
|
|
|
|
DEFAULT => 1, |
496
|
|
|
|
|
|
|
NAME => 'PrintError', |
497
|
|
|
|
|
|
|
REF => '', |
498
|
|
|
|
|
|
|
}, { |
499
|
|
|
|
|
|
|
DEFAULT => 1, |
500
|
|
|
|
|
|
|
NAME => 'RaiseError', |
501
|
|
|
|
|
|
|
REF => '', |
502
|
|
|
|
|
|
|
} |
503
|
|
|
|
|
|
|
], |
504
|
|
|
|
|
|
|
REF => 'HASH', |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
], |
507
|
|
|
|
|
|
|
(%parameters), |
508
|
|
|
|
|
|
|
); |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'CONNECT' => 'connect'); |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=head2 validate |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
if(1 == Anansi::Database::Oracle::validate($OBJECT, undef)); |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
if(1 == Anansi::Database::Oracle::channel($OBJECT, 'VALIDATE_AS_APPROPRIATE')); |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
if(1 == Anansi::Database::Oracle->validate(undef)); |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
if(1 == Anansi::Database::Oracle->channel('VALIDATE_AS_APPROPRIATE')); |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
if(1 == $OBJECT->validate(undef, DRIVER => 'Oracle')); |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
if(1 == $OBJECT->channel('VALIDATE_AS_APPROPRIATE', DRIVER => 'Oracle')); |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
if(1 == Anansi::Database::Oracle->validate(undef, DRIVER => 'Oracle')); |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
if(1 == Anansi::Database::Oracle->channel('VALIDATE_AS_APPROPRIATE', DRIVER => 'Oracle')); |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=over 4 |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
=item self I<(Blessed Hash B String, Required)> |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
Either an object or a string of this namespace. |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=item channel I<(String, Required)> |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
The abstract identifier of a subroutine. |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
=item parameters I<(Hash, Optional)> |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
Named parameters. |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
=over 4 |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
=item DRIVER |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
When the B parameter is defined as I then this database driver |
551
|
|
|
|
|
|
|
component will be used otherwise an attempt will be made to use this driver. |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=back |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=back |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
Overrides L. |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=cut |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
sub validate { |
563
|
0
|
|
|
0
|
1
|
|
my ($self, $channel, %parameters) = @_; |
564
|
0
|
|
|
|
|
|
$parameters{DRIVERS} = 'Oracle'; |
565
|
0
|
|
|
|
|
|
return $self->SUPER::validate(undef, (%parameters)); |
566
|
|
|
|
|
|
|
} |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Database::Oracle', 'VALIDATE_AS_APPROPRIATE' => 'validate'); |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
=head1 NOTES |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
This module is designed to make it simple, easy and quite fast to code your |
575
|
|
|
|
|
|
|
design in perl. If for any reason you feel that it doesn't achieve these goals |
576
|
|
|
|
|
|
|
then please let me know. I am here to help. All constructive criticisms are |
577
|
|
|
|
|
|
|
also welcomed. |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
=cut |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=head1 AUTHOR |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
Kevin Treleaven treleaven I net> |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=cut |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
1; |