ruby-oci8 2.1.5.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +17 -0
- data/COPYING +30 -0
- data/COPYING_old +64 -0
- data/ChangeLog +2779 -0
- data/Makefile +92 -0
- data/NEWS +660 -0
- data/README.md +43 -0
- data/VERSION +1 -0
- data/dist-files +91 -0
- data/docs/install-binary-package.md +40 -0
- data/docs/install-full-client.md +116 -0
- data/docs/install-instant-client.md +167 -0
- data/docs/platform-specific-issues.md +197 -0
- data/docs/report-installation-issue.md +50 -0
- data/lib/.document +1 -0
- data/lib/dbd/OCI8.rb +591 -0
- data/lib/oci8.rb +147 -0
- data/lib/oci8.rb.in +147 -0
- data/lib/oci8/.document +8 -0
- data/lib/oci8/bindtype.rb +350 -0
- data/lib/oci8/compat.rb +113 -0
- data/lib/oci8/connection_pool.rb +108 -0
- data/lib/oci8/cursor.rb +564 -0
- data/lib/oci8/datetime.rb +605 -0
- data/lib/oci8/encoding-init.rb +79 -0
- data/lib/oci8/encoding.yml +537 -0
- data/lib/oci8/metadata.rb +2092 -0
- data/lib/oci8/object.rb +605 -0
- data/lib/oci8/oci8.rb +560 -0
- data/lib/oci8/ocihandle.rb +607 -0
- data/lib/oci8/oracle_version.rb +143 -0
- data/lib/oci8/properties.rb +134 -0
- data/lib/oci8lib_200.so +0 -0
- data/metaconfig +142 -0
- data/pre-distclean.rb +7 -0
- data/ruby-oci8.gemspec +80 -0
- data/setup.rb +1333 -0
- data/test/README +42 -0
- data/test/config.rb +184 -0
- data/test/setup_test_object.sql +171 -0
- data/test/test_all.rb +54 -0
- data/test/test_appinfo.rb +63 -0
- data/test/test_array_dml.rb +333 -0
- data/test/test_bind_raw.rb +46 -0
- data/test/test_bind_string.rb +106 -0
- data/test/test_bind_time.rb +178 -0
- data/test/test_break.rb +124 -0
- data/test/test_clob.rb +98 -0
- data/test/test_connection_pool.rb +125 -0
- data/test/test_connstr.rb +81 -0
- data/test/test_datetime.rb +581 -0
- data/test/test_dbi.rb +366 -0
- data/test/test_dbi_clob.rb +53 -0
- data/test/test_encoding.rb +104 -0
- data/test/test_error.rb +88 -0
- data/test/test_metadata.rb +1485 -0
- data/test/test_object.rb +462 -0
- data/test/test_oci8.rb +489 -0
- data/test/test_oracle_version.rb +70 -0
- data/test/test_oradate.rb +256 -0
- data/test/test_oranumber.rb +787 -0
- data/test/test_rowid.rb +33 -0
- metadata +109 -0
data/test/test_object.rb
ADDED
@@ -0,0 +1,462 @@
|
|
1
|
+
require 'oci8'
|
2
|
+
require 'test/unit'
|
3
|
+
require File.dirname(__FILE__) + '/config'
|
4
|
+
|
5
|
+
conn = OCI8.new($dbuser, $dbpass, $dbname)
|
6
|
+
error_message = nil
|
7
|
+
begin
|
8
|
+
conn.describe_type('rb_test_int_array')
|
9
|
+
conn.describe_type('rb_test_flt_array')
|
10
|
+
conn.describe_type('rb_test_num_array')
|
11
|
+
conn.describe_type('rb_test_bdbl_array')
|
12
|
+
conn.describe_type('rb_test_bflt_array')
|
13
|
+
conn.describe_type('rb_test_str_array')
|
14
|
+
conn.describe_type('rb_test_raw_array')
|
15
|
+
conn.describe_type('rb_test_obj_elem_array')
|
16
|
+
conn.describe_type('rb_test_obj_elem_ary_of_ary')
|
17
|
+
conn.describe_type('rb_test_obj')
|
18
|
+
conn.describe_table('rb_test_obj_tab1')
|
19
|
+
conn.describe_table('rb_test_obj_tab2')
|
20
|
+
|
21
|
+
class RbTestObj < OCI8::Object::Base
|
22
|
+
end
|
23
|
+
|
24
|
+
begin
|
25
|
+
version = RbTestObj.test_object_version(conn)
|
26
|
+
error_message = "Invalid test object version" if version != 2
|
27
|
+
rescue NoMethodError
|
28
|
+
raise unless $!.to_s.include?('test_object_version')
|
29
|
+
error_message = "rb_test_obj.test_object_version is not declared."
|
30
|
+
end
|
31
|
+
rescue OCIError
|
32
|
+
raise if $!.code != 4043
|
33
|
+
error_message = $!.to_s
|
34
|
+
ensure
|
35
|
+
conn.logoff
|
36
|
+
end
|
37
|
+
|
38
|
+
raise <<EOS if error_message
|
39
|
+
|
40
|
+
#{error_message}
|
41
|
+
You need to execute SQL statements in #{File.dirname(__FILE__)}/setup_test_object.sql as follows:
|
42
|
+
|
43
|
+
$ sqlplus USERNAME/PASSWORD
|
44
|
+
SQL> @test/setup_test_object.sql
|
45
|
+
|
46
|
+
EOS
|
47
|
+
|
48
|
+
|
49
|
+
class RbTestIntArray < OCI8::Object::Base
|
50
|
+
end
|
51
|
+
|
52
|
+
class TestObj1 < Test::Unit::TestCase
|
53
|
+
Delta = 0.00001
|
54
|
+
|
55
|
+
def setup
|
56
|
+
@conn = get_oci8_connection
|
57
|
+
RbTestObj.default_connection = @conn
|
58
|
+
end
|
59
|
+
|
60
|
+
def teardown
|
61
|
+
@conn.logoff
|
62
|
+
end
|
63
|
+
|
64
|
+
class ExpectedValObjElem
|
65
|
+
def initialize(x, y)
|
66
|
+
@attributes = {:x => x, :y => y}
|
67
|
+
end
|
68
|
+
def ==(val)
|
69
|
+
@attributes[:x] == val.x and @attributes[:y] == val.y
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class ExpectedVal
|
74
|
+
include Test::Unit::Assertions
|
75
|
+
|
76
|
+
attr_reader :n
|
77
|
+
attr_reader :int_val
|
78
|
+
attr_reader :flt_val
|
79
|
+
attr_reader :num_val
|
80
|
+
attr_reader :bdbl_val
|
81
|
+
attr_reader :bflt_val
|
82
|
+
attr_reader :str_val
|
83
|
+
attr_reader :raw_val
|
84
|
+
attr_reader :clob_val
|
85
|
+
attr_reader :nclob_val
|
86
|
+
attr_reader :blob_val
|
87
|
+
attr_reader :obj_val
|
88
|
+
attr_reader :int_array_val
|
89
|
+
attr_reader :flt_array_val
|
90
|
+
attr_reader :num_array_val
|
91
|
+
attr_reader :bdbl_array_val
|
92
|
+
attr_reader :bflt_array_val
|
93
|
+
attr_reader :str_array_val
|
94
|
+
attr_reader :raw_array_val
|
95
|
+
attr_reader :obj_array_val
|
96
|
+
attr_reader :obj_ary_of_ary_val
|
97
|
+
attr_reader :date_val
|
98
|
+
# attr_reader :date_array_val
|
99
|
+
|
100
|
+
def initialize
|
101
|
+
@n = 0.0
|
102
|
+
end
|
103
|
+
|
104
|
+
def to_test_date(n)
|
105
|
+
year = (1990 + n).round
|
106
|
+
month = (n.round * 5) % 12 + 1
|
107
|
+
mday = (n.round * 7) % 27 + 1
|
108
|
+
hour = (n.round * 9) % 24
|
109
|
+
minute = (n.round * 11) % 60
|
110
|
+
sec = (n.round * 13) % 60
|
111
|
+
convert_to_time(year, month, mday, hour, minute, sec, 0, nil)
|
112
|
+
end
|
113
|
+
private :to_test_date
|
114
|
+
|
115
|
+
def next
|
116
|
+
@n += 1.2
|
117
|
+
@n = (@n * 10).round / 10.0
|
118
|
+
@int_val = @n.round
|
119
|
+
@flt_val = @n
|
120
|
+
@num_val = @n
|
121
|
+
@bdbl_val = @n
|
122
|
+
@bflt_val = @n
|
123
|
+
@str_val = @n.to_s
|
124
|
+
@str_val = $` if /.0$/ =~ @str_val
|
125
|
+
@raw_val = @str_val
|
126
|
+
@clob_val = @str_val
|
127
|
+
@nclob_val = @str_val
|
128
|
+
@blob_val = @str_val
|
129
|
+
@obj_val = ExpectedValObjElem.new(@int_val, @int_val + 1)
|
130
|
+
@date_val = to_test_date(@n)
|
131
|
+
if @int_val == 1
|
132
|
+
@int_array_val = nil
|
133
|
+
@flt_array_val = nil
|
134
|
+
@num_array_val = nil
|
135
|
+
@bdbl_array_val = nil
|
136
|
+
@bflt_array_val = nil
|
137
|
+
@str_array_val = nil
|
138
|
+
@raw_array_val = nil
|
139
|
+
@obj_array_val = nil
|
140
|
+
@obj_ary_of_ary_val = nil
|
141
|
+
# @date_array_val = nil
|
142
|
+
else
|
143
|
+
@int_array_val = []
|
144
|
+
@flt_array_val = []
|
145
|
+
@num_array_val = []
|
146
|
+
@bdbl_array_val = []
|
147
|
+
@bflt_array_val = []
|
148
|
+
@str_array_val = []
|
149
|
+
@raw_array_val = []
|
150
|
+
@obj_array_val = []
|
151
|
+
@obj_ary_of_ary_val = []
|
152
|
+
# @date_array_val = []
|
153
|
+
0.upto(2) do |i|
|
154
|
+
val = (@n + i).to_s
|
155
|
+
val = $` if /.0$/ =~ val
|
156
|
+
@int_array_val[i] = @int_val + i
|
157
|
+
@flt_array_val[i] = @n + i
|
158
|
+
@num_array_val[i] = @n + i
|
159
|
+
@bdbl_array_val[i] = @n + i
|
160
|
+
@bflt_array_val[i] = @n + i
|
161
|
+
@str_array_val[i] = val
|
162
|
+
@raw_array_val[i] = val
|
163
|
+
@obj_array_val[i] = ExpectedValObjElem.new(@int_val + i, @int_val + i + 1)
|
164
|
+
# @date_array_val[i] = to_test_date(@n + i)
|
165
|
+
end
|
166
|
+
@obj_ary_of_ary_val[0] = @obj_array_val
|
167
|
+
end
|
168
|
+
@n <= 20
|
169
|
+
end
|
170
|
+
|
171
|
+
def should_be_equal(val)
|
172
|
+
if val.is_a? Array
|
173
|
+
int_val = val[0]
|
174
|
+
flt_val = val[1]
|
175
|
+
num_val = val[2]
|
176
|
+
bdbl_val = val[3]
|
177
|
+
bflt_val = val[4]
|
178
|
+
str_val = val[5]
|
179
|
+
raw_val = val[6]
|
180
|
+
clob_val = val[7] && val[7].read
|
181
|
+
nclob_val = val[8] && val[8].read
|
182
|
+
blob_val = val[9] && val[9].read
|
183
|
+
obj_val = val[10]
|
184
|
+
int_array_val = val[11]
|
185
|
+
flt_array_val = val[12]
|
186
|
+
num_array_val = val[13]
|
187
|
+
bdbl_array_val = val[14]
|
188
|
+
bflt_array_val = val[15]
|
189
|
+
str_array_val = val[16]
|
190
|
+
raw_array_val = val[17]
|
191
|
+
obj_array_val = val[18]
|
192
|
+
obj_ary_of_ary_val = val[19]
|
193
|
+
date_val = val[20]
|
194
|
+
# date_array_val = val[18]
|
195
|
+
else
|
196
|
+
assert_instance_of(RbTestObj, val)
|
197
|
+
int_val = val.int_val
|
198
|
+
flt_val = val.flt_val
|
199
|
+
num_val = val.num_val
|
200
|
+
bdbl_val = val.bdbl_val
|
201
|
+
bflt_val = val.bflt_val
|
202
|
+
str_val = val.str_val
|
203
|
+
raw_val = val.raw_val
|
204
|
+
clob_val = val.clob_val && val.clob_val.read
|
205
|
+
nclob_val = val.nclob_val && val.nclob_val.read
|
206
|
+
blob_val = val.blob_val && val.blob_val.read
|
207
|
+
obj_val = val.obj_val
|
208
|
+
int_array_val = val.int_array_val
|
209
|
+
flt_array_val = val.flt_array_val
|
210
|
+
num_array_val = val.num_array_val
|
211
|
+
bdbl_array_val = val.bdbl_array_val
|
212
|
+
bflt_array_val = val.bflt_array_val
|
213
|
+
str_array_val = val.str_array_val
|
214
|
+
raw_array_val = val.raw_array_val
|
215
|
+
obj_array_val = val.obj_array_val
|
216
|
+
obj_ary_of_ary_val = val.obj_ary_of_ary_val
|
217
|
+
date_val = val.date_val
|
218
|
+
# date_array_val = val.date_array_val
|
219
|
+
end
|
220
|
+
|
221
|
+
assert_equal(@int_val, int_val)
|
222
|
+
assert_in_delta(@flt_val, flt_val, Delta)
|
223
|
+
assert_in_delta(@num_val, num_val, Delta)
|
224
|
+
assert_in_delta(@bdbl_val, bdbl_val, Delta)
|
225
|
+
assert_in_delta(@bflt_val, bflt_val, Delta)
|
226
|
+
assert_equal(@str_val, str_val)
|
227
|
+
assert_equal(@raw_val, raw_val)
|
228
|
+
assert_equal(@clob_val, clob_val)
|
229
|
+
assert_equal(@nclob_val, nclob_val)
|
230
|
+
assert_equal(@blob_val, blob_val)
|
231
|
+
assert_equal(@obj_val, obj_val)
|
232
|
+
assert_equal(@int_array_val, int_array_val && int_array_val.to_ary)
|
233
|
+
assert_array_in_delta(@flt_array_val, flt_array_val && flt_array_val.to_ary)
|
234
|
+
assert_array_in_delta(@num_array_val, num_array_val && num_array_val.to_ary)
|
235
|
+
assert_array_in_delta(@bdbl_array_val, bdbl_array_val && bdbl_array_val.to_ary)
|
236
|
+
assert_array_in_delta(@bflt_array_val, bflt_array_val && bflt_array_val.to_ary)
|
237
|
+
assert_equal(@str_array_val, str_array_val && str_array_val.to_ary)
|
238
|
+
assert_equal(@raw_array_val, raw_array_val && raw_array_val.to_ary)
|
239
|
+
assert_equal(@obj_array_val, obj_array_val && obj_array_val.to_ary)
|
240
|
+
assert_equal(@obj_ary_of_ary_val, obj_ary_of_ary_val && obj_ary_of_ary_val.to_ary.collect { |elem| elem.to_ary })
|
241
|
+
assert_equal(@date_val, date_val)
|
242
|
+
# assert_equal(@date_array_val, date_array_val && date_array_val.to_ary)
|
243
|
+
end
|
244
|
+
|
245
|
+
def assert_array_in_delta(exp, val)
|
246
|
+
if exp && val
|
247
|
+
assert_equal(exp.size, val.size)
|
248
|
+
exp.each_with_index do |elem, idx|
|
249
|
+
assert_in_delta(elem, val[idx], Delta)
|
250
|
+
end
|
251
|
+
else
|
252
|
+
assert_equal(exp, val)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_select1
|
258
|
+
expected_val = ExpectedVal.new
|
259
|
+
@conn.exec("select * from rb_test_obj_tab1 order by n") do |row|
|
260
|
+
assert(expected_val.next)
|
261
|
+
|
262
|
+
assert_in_delta(expected_val.n, row[0], Delta)
|
263
|
+
expected_val.should_be_equal(row[1])
|
264
|
+
end
|
265
|
+
assert(!expected_val.next)
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_select2
|
269
|
+
expected_val = ExpectedVal.new
|
270
|
+
orig_val = OCI8::BindType::Mapping[:date]
|
271
|
+
begin
|
272
|
+
@conn.exec("select * from rb_test_obj_tab2 order by int_val") do |row|
|
273
|
+
assert(expected_val.next)
|
274
|
+
expected_val.should_be_equal(row)
|
275
|
+
end
|
276
|
+
assert(!expected_val.next)
|
277
|
+
ensure
|
278
|
+
OCI8::BindType::Mapping[:date] = orig_val
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_select3
|
283
|
+
expected_val = ExpectedVal.new
|
284
|
+
@conn.exec("select value(p) from rb_test_obj_tab2 p order by int_val") do |row|
|
285
|
+
assert(expected_val.next)
|
286
|
+
expected_val.should_be_equal(row[0])
|
287
|
+
end
|
288
|
+
assert(!expected_val.next)
|
289
|
+
end
|
290
|
+
|
291
|
+
def _test_select4 # TODO
|
292
|
+
expected_val = ExpectedVal.new
|
293
|
+
@conn.exec("select ref(p) from rb_test_obj_tab2 p order by int_val") do |row|
|
294
|
+
assert(expected_val.next)
|
295
|
+
|
296
|
+
expected_val.should_be_equal(row[0])
|
297
|
+
end
|
298
|
+
assert(!expected_val.next)
|
299
|
+
end
|
300
|
+
|
301
|
+
def test_explicit_constructor
|
302
|
+
expected_val = ExpectedVal.new
|
303
|
+
while expected_val.next
|
304
|
+
obj = RbTestObj.new(expected_val.n)
|
305
|
+
expected_val.should_be_equal(obj)
|
306
|
+
assert_nothing_raised do
|
307
|
+
obj.inspect
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
def _test_implicit_constructor # TODO
|
313
|
+
expected_val = ExpectedVal.new
|
314
|
+
while expected_val.next
|
315
|
+
obj = RbTestObj.new(expected_val.int_val, expected_val.flt_val, expected_val.str_val, expected_val.raw_val, expected_val.str_array_val, expected_val.raw_array_val, expected_val.num_array_val)
|
316
|
+
expected_val.should_be_equal(obj)
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
def _test_implicit_constructor2 # TODO
|
321
|
+
obj = nil
|
322
|
+
assert_nothing_raised do
|
323
|
+
obj = RbTestObj.new(nil, nil, nil)
|
324
|
+
end
|
325
|
+
assert_nil(obj.int_val)
|
326
|
+
assert_nil(obj.flt_val)
|
327
|
+
assert_nil(obj.str_val)
|
328
|
+
end
|
329
|
+
|
330
|
+
def _test_class_func
|
331
|
+
expected_val = ExpectedVal.new
|
332
|
+
while expected_val.next
|
333
|
+
obj = RbTestObj.class_func(expected_val.n)
|
334
|
+
expected_val.should_be_equal(obj)
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
def test_class_proc1
|
339
|
+
expected_val = ExpectedVal.new
|
340
|
+
while expected_val.next
|
341
|
+
obj = RbTestObj.new(0)
|
342
|
+
RbTestObj.class_proc1(obj, expected_val.n)
|
343
|
+
expected_val.should_be_equal(obj)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
def _test_class_proc2
|
348
|
+
expected_val = ExpectedVal.new
|
349
|
+
while expected_val.next
|
350
|
+
obj = RbTestObj.new
|
351
|
+
obj.int_val = expected_val.int_val - 1
|
352
|
+
obj.flt_val = expected_val.flt_val
|
353
|
+
obj.num_val = expected_val.num_val
|
354
|
+
obj.bdbl_val = expected_val.bdbl_val
|
355
|
+
obj.bflt_val = expected_val.bflt_val
|
356
|
+
obj.str_val = expected_val.str_val
|
357
|
+
obj.raw_val = expected_val.raw_val
|
358
|
+
obj.clob_val = expected_val.clob_val
|
359
|
+
obj.nclob_val = expected_val.nclob_val
|
360
|
+
obj.blob_val = expected_val.blob_val
|
361
|
+
obj.obj_val = expected_val.obj_val
|
362
|
+
obj.int_array_val = expected_val.int_array_val
|
363
|
+
obj.flt_array_val = expected_val.flt_array_val
|
364
|
+
obj.num_array_val = expected_val.num_array_val
|
365
|
+
obj.bdbl_array_val = expected_val.bdbl_array_val
|
366
|
+
obj.bflt_array_val = expected_val.bflt_array_val
|
367
|
+
obj.str_array_val = expected_val.str_array_val
|
368
|
+
obj.raw_array_val = expected_val.raw_array_val
|
369
|
+
obj.obj_array_val = expected_val.obj_array_val
|
370
|
+
obj.obj_ary_of_ary_val = expected_val.obj_ary_of_ary_val
|
371
|
+
RbTestObj.class_proc2(obj)
|
372
|
+
expected_val.should_be_equal(obj)
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
def test_member_func
|
377
|
+
expected_val = ExpectedVal.new
|
378
|
+
while expected_val.next
|
379
|
+
obj = RbTestObj.new(expected_val.n)
|
380
|
+
assert_equal(expected_val.int_val, obj.member_func)
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
def _test_plsql_member_func
|
385
|
+
expected_val = ExpectedVal.new
|
386
|
+
while expected_val.next
|
387
|
+
obj = RbTestObj.new(expected_val.n)
|
388
|
+
rv = @conn.exec(<<EOS, obj, [nil, Integer])
|
389
|
+
declare
|
390
|
+
obj rb_test_obj := :obj;
|
391
|
+
begin
|
392
|
+
:rv := obj.member_func;
|
393
|
+
end;
|
394
|
+
EOS
|
395
|
+
assert_equal(expected_val.int_val, rv[1])
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
def test_member_proc
|
400
|
+
expected_val = ExpectedVal.new
|
401
|
+
while expected_val.next
|
402
|
+
obj = RbTestObj.new
|
403
|
+
obj.member_proc(expected_val.int_val)
|
404
|
+
assert_equal(expected_val.int_val, obj.int_val)
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
def test_bind_nil
|
409
|
+
csr = @conn.parse(<<EOS)
|
410
|
+
DECLARE
|
411
|
+
obj RB_TEST_OBJ := :in;
|
412
|
+
BEGIN
|
413
|
+
IF obj IS NULL THEN
|
414
|
+
:out := 'IS NULL';
|
415
|
+
ELSE
|
416
|
+
:out := 'IS NOT NULL';
|
417
|
+
END IF;
|
418
|
+
END;
|
419
|
+
EOS
|
420
|
+
csr.bind_param(:in, nil, RbTestObj)
|
421
|
+
csr.bind_param(:out, nil, String, 11)
|
422
|
+
csr.exec
|
423
|
+
assert_equal('IS NULL', csr[:out])
|
424
|
+
csr[:in] = RbTestObj.new(@conn)
|
425
|
+
csr.exec
|
426
|
+
assert_equal('IS NOT NULL', csr[:out])
|
427
|
+
csr[:in] = nil
|
428
|
+
csr.exec
|
429
|
+
assert_equal('IS NULL', csr[:out])
|
430
|
+
end
|
431
|
+
|
432
|
+
def test_bind_array
|
433
|
+
csr = @conn.parse <<EOS
|
434
|
+
DECLARE
|
435
|
+
ary RB_TEST_INT_ARRAY := :in;
|
436
|
+
BEGIN
|
437
|
+
IF ary IS NULL THEN
|
438
|
+
:cnt := -1;
|
439
|
+
ELSE
|
440
|
+
:cnt := ary.count;
|
441
|
+
IF :cnt != 0 THEN
|
442
|
+
:out1 := ary(1);
|
443
|
+
:out2 := ary(2);
|
444
|
+
:out3 := ary(3);
|
445
|
+
END IF;
|
446
|
+
END IF;
|
447
|
+
END;
|
448
|
+
EOS
|
449
|
+
[nil, [], [1, nil, 3]].each do |ary|
|
450
|
+
csr.bind_param(:in, ary, RbTestIntArray)
|
451
|
+
csr.bind_param(:cnt, nil, Integer)
|
452
|
+
csr.bind_param(:out1, nil, Integer)
|
453
|
+
csr.bind_param(:out2, nil, Integer)
|
454
|
+
csr.bind_param(:out3, nil, Integer)
|
455
|
+
csr.exec
|
456
|
+
assert_equal(ary ? ary.length : -1, csr[:cnt])
|
457
|
+
assert_equal(ary ? ary[0] : nil, csr[:out1])
|
458
|
+
assert_equal(ary ? ary[1] : nil, csr[:out2])
|
459
|
+
assert_equal(ary ? ary[2] : nil, csr[:out3])
|
460
|
+
end
|
461
|
+
end
|
462
|
+
end
|