ruby-oci8 1.0.7-x86-mswin32-60 → 2.0.1-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1289 -383
- data/Makefile +48 -12
- data/NEWS +5 -419
- data/README +56 -385
- data/VERSION +1 -1
- data/dist-files +27 -27
- data/lib/.document +2 -0
- data/lib/dbd/OCI8.rb +2 -17
- data/lib/oci8.rb +48 -1622
- data/lib/oci8.rb.in +48 -1622
- data/lib/oci8/.document +5 -0
- data/lib/oci8/compat.rb +108 -0
- data/lib/oci8/datetime.rb +491 -0
- data/lib/oci8/encoding-init.rb +40 -0
- data/lib/oci8/encoding.yml +537 -0
- data/lib/oci8/metadata.rb +2077 -0
- data/lib/oci8/object.rb +548 -0
- data/lib/oci8/oci8.rb +798 -0
- data/lib/oci8/oracle_version.rb +144 -0
- data/lib/oci8lib_18.so +0 -0
- data/lib/oci8lib_191.so +0 -0
- data/metaconfig +3 -3
- data/ruby-oci8.gemspec +24 -15
- data/setup.rb +4 -4
- data/test/config.rb +64 -84
- data/test/test_all.rb +14 -21
- data/test/test_array_dml.rb +333 -0
- data/test/test_bind_raw.rb +18 -25
- data/test/test_bind_time.rb +78 -91
- data/test/test_break.rb +37 -35
- data/test/test_clob.rb +33 -89
- data/test/test_connstr.rb +5 -4
- data/test/test_datetime.rb +469 -0
- data/test/test_dbi.rb +99 -60
- data/test/test_dbi_clob.rb +3 -8
- data/test/test_metadata.rb +65 -51
- data/test/test_oci8.rb +151 -55
- data/test/test_oracle_version.rb +70 -0
- data/test/test_oradate.rb +76 -83
- data/test/test_oranumber.rb +405 -71
- data/test/test_rowid.rb +6 -11
- metadata +21 -25
- data/ext/oci8/oci8lib.so +0 -0
- data/ruby-oci8.spec +0 -62
- data/support/README +0 -4
- data/support/runit/assert.rb +0 -281
- data/support/runit/cui/testrunner.rb +0 -101
- data/support/runit/error.rb +0 -4
- data/support/runit/method_mappable.rb +0 -20
- data/support/runit/robserver.rb +0 -25
- data/support/runit/setuppable.rb +0 -15
- data/support/runit/teardownable.rb +0 -16
- data/support/runit/testcase.rb +0 -113
- data/support/runit/testfailure.rb +0 -25
- data/support/runit/testresult.rb +0 -121
- data/support/runit/testsuite.rb +0 -43
- data/support/runit/version.rb +0 -3
- data/test/test_describe.rb +0 -137
data/test/test_dbi.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
require 'dbi'
|
2
2
|
require 'oci8'
|
3
|
-
require '
|
4
|
-
require 'runit/cui/testrunner'
|
3
|
+
require 'test/unit'
|
5
4
|
require File.dirname(__FILE__) + '/config'
|
6
5
|
|
7
|
-
class TestDBI <
|
6
|
+
class TestDBI < Test::Unit::TestCase
|
8
7
|
|
9
8
|
def setup
|
10
9
|
@dbh = get_dbi_connection()
|
11
10
|
end
|
12
11
|
|
12
|
+
def teardown
|
13
|
+
@dbh.disconnect
|
14
|
+
end
|
15
|
+
|
13
16
|
def test_select
|
14
17
|
drop_table('test_table')
|
15
18
|
sql = <<-EOS
|
@@ -99,19 +102,34 @@ EOS
|
|
99
102
|
sth = @dbh.prepare("INSERT INTO test_table VALUES (:C, :V, :N, :D1, :D2, :D3, :D4, :INT, :BIGNUM)")
|
100
103
|
1.upto(10) do |i|
|
101
104
|
if i == 1
|
102
|
-
|
103
|
-
|
105
|
+
if OCI8::oracle_client_version >= OCI8::ORAVER_9_0
|
106
|
+
dt = nil
|
107
|
+
v = ''
|
108
|
+
sth.execute(format("%10d", i * 10), v, i, dt, dt, dt, dt, i, i)
|
109
|
+
else
|
110
|
+
# explicitly bind nil with datatype to avoid ORA-01475 when using Oracle 8i.
|
111
|
+
sth.bind_param(1, format("%10d", i * 10))
|
112
|
+
sth.bind_param(2, '')
|
113
|
+
sth.bind_param(3, i)
|
114
|
+
sth.bind_param(4, nil, {'type' => OraDate})
|
115
|
+
sth.bind_param(5, nil, {'type' => OraDate})
|
116
|
+
sth.bind_param(6, nil, {'type' => OraDate})
|
117
|
+
sth.bind_param(7, nil, {'type' => OraDate})
|
118
|
+
sth.bind_param(8, i)
|
119
|
+
sth.bind_param(9, i)
|
120
|
+
sth.execute
|
121
|
+
end
|
104
122
|
else
|
105
|
-
|
123
|
+
dt = OraDate.new(2000 + i, 8, 3, 23, 59, 59)
|
106
124
|
v = i.to_s
|
125
|
+
sth.execute(format("%10d", i * 10), v, i, dt, dt, dt, dt, i, i)
|
107
126
|
end
|
108
|
-
sth.execute(format("%10d", i * 10), v, i, dt, dt, dt, dt, i, i)
|
109
127
|
end
|
110
128
|
sth.finish
|
111
129
|
sth = @dbh.prepare("SELECT * FROM test_table ORDER BY c")
|
112
130
|
sth.func(:define, 5, Time) # define 5th column as Time
|
113
131
|
sth.func(:define, 6, Date) # define 6th column as Date
|
114
|
-
sth.func(:define, 7, DateTime)
|
132
|
+
sth.func(:define, 7, DateTime) # define 7th column as DateTime
|
115
133
|
sth.func(:define, 8, Integer) # define 8th column as Integer
|
116
134
|
sth.func(:define, 9, Bignum) # define 9th column as Bignum
|
117
135
|
sth.execute
|
@@ -128,14 +146,16 @@ EOS
|
|
128
146
|
assert_nil(rv[6])
|
129
147
|
else
|
130
148
|
assert_equal(i.to_s, rv[1])
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
assert_equal(
|
135
|
-
assert_equal(
|
149
|
+
tm = Time.local(2000 + i, 8, 3, 23, 59, 59)
|
150
|
+
dt = Date.civil(2000 + i, 8, 3)
|
151
|
+
dttm = DateTime.civil(2000 + i, 8, 3, 23, 59, 59, Time.now.utc_offset.to_r/86400)
|
152
|
+
assert_equal(tm, rv[3])
|
153
|
+
assert_equal(tm, rv[4])
|
154
|
+
assert_equal(dt, rv[5])
|
155
|
+
assert_equal(dttm, rv[6])
|
136
156
|
assert_instance_of(Time, rv[4])
|
137
157
|
assert_instance_of(Date, rv[5])
|
138
|
-
assert_instance_of(DateTime, rv[6])
|
158
|
+
assert_instance_of(DateTime, rv[6])
|
139
159
|
end
|
140
160
|
assert_equal(i, rv[7])
|
141
161
|
assert_equal(i, rv[8])
|
@@ -170,47 +190,62 @@ EOS
|
|
170
190
|
end
|
171
191
|
|
172
192
|
def test_column_info
|
193
|
+
if $oracle_version < OCI8::ORAVER_8_1
|
194
|
+
begin
|
195
|
+
@dbh.columns('tab')
|
196
|
+
rescue RuntimeError
|
197
|
+
assert_equal("This feature is unavailable on Oracle 8.0", $!.to_s)
|
198
|
+
end
|
199
|
+
return
|
200
|
+
end
|
201
|
+
|
173
202
|
# data_size factor for nchar charset_form.
|
174
|
-
sth = @dbh.execute("select
|
203
|
+
sth = @dbh.execute("select N'1' from dual")
|
175
204
|
cfrm = sth.column_info[0]['precision']
|
176
|
-
if $oracle_version >=
|
205
|
+
if $oracle_version >= OCI8::ORAVER_9_0
|
177
206
|
# data_size factor for char semantics.
|
178
207
|
sth = @dbh.execute("select CAST('1' AS CHAR(1 char)) from dual")
|
179
208
|
csem = sth.column_info[0]['precision']
|
209
|
+
else
|
210
|
+
csem = 1
|
180
211
|
end
|
181
212
|
|
213
|
+
ora80 = OCI8::ORAVER_8_0
|
214
|
+
ora81 = OCI8::ORAVER_8_1
|
215
|
+
ora90 = OCI8::ORAVER_9_0
|
216
|
+
ora101 = OCI8::ORAVER_10_1
|
182
217
|
coldef =
|
183
218
|
[
|
184
219
|
# oracle_version, definition, sql_type, type_name, nullable, precision,scale,indexed,primary,unique,default
|
185
|
-
[
|
186
|
-
[
|
187
|
-
[
|
188
|
-
[
|
189
|
-
[
|
190
|
-
[
|
191
|
-
[
|
192
|
-
[
|
193
|
-
[
|
194
|
-
[
|
195
|
-
[
|
196
|
-
[
|
197
|
-
[
|
198
|
-
[
|
199
|
-
[
|
200
|
-
[
|
201
|
-
[
|
202
|
-
[
|
203
|
-
[
|
204
|
-
[
|
205
|
-
[
|
206
|
-
[
|
207
|
-
[
|
208
|
-
[
|
209
|
-
[
|
210
|
-
[
|
211
|
-
[
|
212
|
-
[
|
213
|
-
[
|
220
|
+
[ora80, "CHAR(10) NOT NULL", DBI::SQL_CHAR, 'CHAR', false, 10, nil, true, true, true, nil],
|
221
|
+
[ora90, "CHAR(10 CHAR)", DBI::SQL_CHAR, 'CHAR', true, 10 * csem, nil, false,false,false,nil],
|
222
|
+
[ora80, "NCHAR(10)", DBI::SQL_CHAR, 'NCHAR', true, 10 * cfrm, nil, true, false,true, nil],
|
223
|
+
[ora80, "VARCHAR2(10) DEFAULT 'a''b'", DBI::SQL_VARCHAR, 'VARCHAR2', true, 10, nil, true, false,false, "a'b"],
|
224
|
+
[ora90, "VARCHAR2(10 CHAR)", DBI::SQL_VARCHAR, 'VARCHAR2', true, 10 * csem, nil, false,false,false,nil],
|
225
|
+
[ora80, "NVARCHAR2(10)", DBI::SQL_VARCHAR, 'NVARCHAR2',true, 10 * cfrm, nil, false,false,false,nil],
|
226
|
+
[ora80, "RAW(10)", DBI::SQL_VARBINARY, 'RAW', true, 10, nil, false,false,false,nil],
|
227
|
+
[ora81, "CLOB", DBI::SQL_CLOB, 'CLOB', true, 4000, nil, false,false,false,nil],
|
228
|
+
[ora81, "NCLOB", DBI::SQL_CLOB, 'NCLOB', true, 4000, nil, false,false,false,nil],
|
229
|
+
[ora80, "BLOB", DBI::SQL_BLOB, 'BLOB', true, 4000, nil, false,false,false,nil],
|
230
|
+
[ora80, "BFILE", DBI::SQL_BLOB, 'BFILE', true, 4000, nil, false,false,false,nil],
|
231
|
+
[ora80, "NUMBER", DBI::SQL_NUMERIC, 'NUMBER', true, 38, nil, false,false,false,nil],
|
232
|
+
[ora80, "NUMBER(10)", DBI::SQL_NUMERIC, 'NUMBER', true, 10, 0, false,false,false,nil],
|
233
|
+
[ora80, "NUMBER(10,2)", DBI::SQL_NUMERIC, 'NUMBER', true, 10, 2, false,false,false,nil],
|
234
|
+
[ora80, "FLOAT", DBI::SQL_FLOAT, 'FLOAT', true, (126 * 0.30103).ceil, nil, false,false,false,nil],
|
235
|
+
[ora80, "FLOAT(10)", DBI::SQL_FLOAT, 'FLOAT', true, (10 * 0.30103).ceil, nil, false,false,false,nil],
|
236
|
+
[ora101,"BINARY_FLOAT", DBI::SQL_FLOAT, 'BINARY_FLOAT', true, 7, nil, false,false,false,nil],
|
237
|
+
[ora101,"BINARY_DOUBLE", DBI::SQL_DOUBLE, 'BINARY_DOUBLE', true, 16, nil, false,false,false,nil],
|
238
|
+
[ora80, "DATE", DBI::SQL_DATE, 'DATE', true, 19, nil, false,false,false,nil],
|
239
|
+
[ora90, "TIMESTAMP", DBI::SQL_TIMESTAMP, 'TIMESTAMP', true, 20 + 6, nil, false,false,false,nil],
|
240
|
+
[ora90, "TIMESTAMP(9)", DBI::SQL_TIMESTAMP, 'TIMESTAMP', true, 20 + 9, nil, false,false,false,nil],
|
241
|
+
[ora90, "TIMESTAMP WITH TIME ZONE", DBI::SQL_TIMESTAMP, 'TIMESTAMP WITH TIME ZONE', true, 27 + 6, nil, false,false,false,nil],
|
242
|
+
[ora90, "TIMESTAMP(9) WITH TIME ZONE", DBI::SQL_TIMESTAMP, 'TIMESTAMP WITH TIME ZONE', true, 27 + 9, nil, false,false,false,nil],
|
243
|
+
[ora90, "TIMESTAMP WITH LOCAL TIME ZONE", DBI::SQL_TIMESTAMP, 'TIMESTAMP WITH LOCAL TIME ZONE', true, 20 + 6, nil, false,false,false,nil],
|
244
|
+
[ora90, "TIMESTAMP(9) WITH LOCAL TIME ZONE", DBI::SQL_TIMESTAMP, 'TIMESTAMP WITH LOCAL TIME ZONE', true, 20 + 9, nil, false,false,false,nil],
|
245
|
+
[ora90, "INTERVAL YEAR TO MONTH", DBI::SQL_OTHER, 'INTERVAL YEAR TO MONTH', true, 2 + 3, nil, false,false,false,nil],
|
246
|
+
[ora90, "INTERVAL YEAR(4) TO MONTH", DBI::SQL_OTHER, 'INTERVAL YEAR TO MONTH', true, 4 + 3, nil, false,false,false,nil],
|
247
|
+
[ora90, "INTERVAL DAY TO SECOND", DBI::SQL_OTHER, 'INTERVAL DAY TO SECOND', true, 2 + 10 + 6, nil, false,false,false,nil],
|
248
|
+
[ora90, "INTERVAL DAY(4) TO SECOND(9)",DBI::SQL_OTHER, 'INTERVAL DAY TO SECOND', true, 4 + 10 + 9, nil, false,false,false,nil],
|
214
249
|
]
|
215
250
|
|
216
251
|
coldef.reject! do |c| c[0] > $oracle_version end
|
@@ -293,17 +328,25 @@ EOS
|
|
293
328
|
["TABTYPE", DBI::SQL_VARCHAR,'VARCHAR2',true, 7, nil, false, false, false, nil],
|
294
329
|
["CLUSTERID",DBI::SQL_NUMERIC,'NUMBER', true, 38, nil, false, false, false, nil],
|
295
330
|
]
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
331
|
+
begin
|
332
|
+
@dbh.columns('tab').each_with_index do |ci, i|
|
333
|
+
assert_equal(coldef[i][0], ci['name'], "'#{coldef[i][0]}': name")
|
334
|
+
assert_equal(coldef[i][1], ci['sql_type'], "'#{coldef[i][0]}': sql_type")
|
335
|
+
assert_equal(coldef[i][2], ci['type_name'], "'#{coldef[i][0]}': type_name")
|
336
|
+
assert_equal(coldef[i][3], ci['nullable'], "'#{coldef[i][0]}': nullable")
|
337
|
+
assert_equal(coldef[i][4], ci['precision'], "'#{coldef[i][0]}': precision")
|
338
|
+
assert_equal(coldef[i][5], ci['scale'], "'#{coldef[i][0]}': scale")
|
339
|
+
assert_equal(coldef[i][6], ci['indexed'], "'#{coldef[i][0]}': indexed")
|
340
|
+
assert_equal(coldef[i][7], ci['primary'], "'#{coldef[i][0]}': primary")
|
341
|
+
assert_equal(coldef[i][8], ci['unique'], "'#{coldef[i][0]}': unique")
|
342
|
+
assert_equal(coldef[i][9], ci['default'], "'#{coldef[i][0]}': default")
|
343
|
+
end
|
344
|
+
rescue RuntimeError
|
345
|
+
if $oracle_version < OCI8::ORAVER_8_1
|
346
|
+
assert_equal("This feature is unavailable on Oracle 8.0", $!.to_s)
|
347
|
+
else
|
348
|
+
raise
|
349
|
+
end
|
307
350
|
end
|
308
351
|
|
309
352
|
@dbh.execute("SELECT * FROM tab").column_info.each_with_index do |ci, i|
|
@@ -321,7 +364,3 @@ EOS
|
|
321
364
|
end
|
322
365
|
|
323
366
|
end # TestDBI
|
324
|
-
|
325
|
-
if $0 == __FILE__
|
326
|
-
RUNIT::CUI::TestRunner.run(TestDBI.suite())
|
327
|
-
end
|
data/test/test_dbi_clob.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'dbi'
|
2
2
|
require 'oci8'
|
3
|
-
require '
|
4
|
-
require 'runit/cui/testrunner'
|
3
|
+
require 'test/unit'
|
5
4
|
require File.dirname(__FILE__) + '/config'
|
6
5
|
|
7
|
-
class TestDbiCLob <
|
6
|
+
class TestDbiCLob < Test::Unit::TestCase
|
8
7
|
|
9
8
|
def setup
|
10
9
|
@dbh = get_dbi_connection()
|
@@ -49,10 +48,6 @@ class TestDbiCLob < RUNIT::TestCase
|
|
49
48
|
end
|
50
49
|
|
51
50
|
def teardown
|
52
|
-
@dbh.disconnect
|
51
|
+
@dbh.disconnect
|
53
52
|
end
|
54
53
|
end
|
55
|
-
|
56
|
-
if $0 == __FILE__
|
57
|
-
RUNIT::CUI::TestRunner.run(TestDbiCLob.suite())
|
58
|
-
end
|
data/test/test_metadata.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'oci8'
|
2
|
-
require '
|
3
|
-
require 'runit/cui/testrunner'
|
2
|
+
require 'test/unit'
|
4
3
|
require File.dirname(__FILE__) + '/config'
|
5
4
|
|
6
|
-
class TestMetadata <
|
5
|
+
class TestMetadata < Test::Unit::TestCase
|
7
6
|
|
8
7
|
def setup
|
9
|
-
@conn =
|
8
|
+
@conn = get_oci8_connection
|
10
9
|
end
|
11
10
|
|
12
11
|
def teardown
|
@@ -14,25 +13,40 @@ class TestMetadata < RUNIT::TestCase
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def test_metadata
|
16
|
+
if $oracle_version < OCI8::ORAVER_8_1
|
17
|
+
begin
|
18
|
+
@conn.describe_table('tab').columns
|
19
|
+
rescue RuntimeError
|
20
|
+
assert_equal("This feature is unavailable on Oracle 8.0", $!.to_s)
|
21
|
+
end
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
17
25
|
# data_size factor for nchar charset_form.
|
18
|
-
cursor = @conn.exec("select
|
26
|
+
cursor = @conn.exec("select N'1' from dual")
|
19
27
|
cfrm = cursor.column_metadata[0].data_size
|
20
|
-
if $oracle_version >=
|
28
|
+
if $oracle_version >= OCI8::ORAVER_9_0
|
21
29
|
# data_size factor for char semantics.
|
22
30
|
cursor = @conn.exec("select CAST('1' AS CHAR(1 char)) from dual")
|
23
31
|
csem = cursor.column_metadata[0].data_size
|
32
|
+
else
|
33
|
+
csem = 1
|
24
34
|
end
|
25
35
|
|
36
|
+
ora80 = OCI8::ORAVER_8_0
|
37
|
+
ora81 = OCI8::ORAVER_8_1
|
38
|
+
ora90 = OCI8::ORAVER_9_0
|
39
|
+
ora101 = OCI8::ORAVER_10_1
|
26
40
|
coldef =
|
27
41
|
[
|
28
|
-
# oracle_version, definition, data_type, csfrm,
|
29
|
-
[
|
30
|
-
[
|
31
|
-
[
|
32
|
-
[
|
33
|
-
[
|
34
|
-
[
|
35
|
-
[
|
42
|
+
# oracle_version, definition, data_type, csfrm, null?,csem?,csize, data_size,prec,scale,fsprec,lfprec
|
43
|
+
[ora80, "CHAR(10) NOT NULL", :char, :implicit, false, false, 10, 10, 0, 0, 0, 0],
|
44
|
+
[ora90, "CHAR(10 CHAR)", :char, :implicit, true, true, 10, 10 * csem, 0, 0, 0, 0],
|
45
|
+
[ora80, "NCHAR(10)", :char, :nchar, true, true, 10, 10 * cfrm, 0, 0, 0, 0],
|
46
|
+
[ora80, "VARCHAR2(10)", :varchar2, :implicit, true, false, 10, 10, 0, 0, 0, 0],
|
47
|
+
[ora90, "VARCHAR2(10 CHAR)", :varchar2, :implicit, true, true, 10, 10 * csem, 0, 0, 0, 0],
|
48
|
+
[ora80, "NVARCHAR2(10)", :varchar2, :nchar, true, true, 10, 10 * cfrm, 0, 0, 0, 0],
|
49
|
+
[ora80, "RAW(10)", :raw, nil, true, false, 0, 10, 0, 0, 0, 0],
|
36
50
|
|
37
51
|
# Don't check data_size of CLOB, NCLOB and BLOB.
|
38
52
|
#
|
@@ -43,11 +57,11 @@ class TestMetadata < RUNIT::TestCase
|
|
43
57
|
# | implicit | 4000 | <= OCI8::Cursor#column_metadata
|
44
58
|
# | explicit | 86 | <= OCI8.describe_table('table_name').columns
|
45
59
|
# +----------+-----------+
|
46
|
-
[
|
47
|
-
[
|
48
|
-
[
|
60
|
+
[ora81, "CLOB", :clob, :implicit, true, false, 0, :nc, 0, 0, 0, 0],
|
61
|
+
[ora81, "NCLOB", :clob, :nchar, true, false, 0, :nc, 0, 0, 0, 0],
|
62
|
+
[ora80, "BLOB", :blob, nil, true, false, 0, :nc, 0, 0, 0, 0],
|
49
63
|
|
50
|
-
[
|
64
|
+
[ora80, "BFILE", :bfile, nil, true, false, 0, 530, 0, 0, 0, 0],
|
51
65
|
|
52
66
|
# Don't check fsprecision and lfprecision for NUMBER and FLOAT
|
53
67
|
#
|
@@ -70,15 +84,15 @@ class TestMetadata < RUNIT::TestCase
|
|
70
84
|
# | FLOAT(10) | implicit | 129 | 10 |
|
71
85
|
# | | explicit | 10 | 129 |
|
72
86
|
# +----------------+----------+-------------+-------------+
|
73
|
-
[
|
74
|
-
[
|
75
|
-
[
|
76
|
-
[
|
77
|
-
[
|
87
|
+
[ora80, "NUMBER", :number, nil, true, false, 0, 22, 0, $oracle_version >= ora90 ? -127 : 0, :nc, :nc],
|
88
|
+
[ora80, "NUMBER(10)", :number, nil, true, false, 0, 22, 10, 0, :nc, :nc],
|
89
|
+
[ora80, "NUMBER(10,2)", :number, nil, true, false, 0, 22, 10, 2, :nc, :nc],
|
90
|
+
[ora80, "FLOAT", :number, nil, true, false, 0, 22, 126, -127, :nc, :nc],
|
91
|
+
[ora80, "FLOAT(10)", :number, nil, true, false, 0, 22, 10, -127, :nc, :nc],
|
78
92
|
|
79
|
-
[
|
80
|
-
[
|
81
|
-
[
|
93
|
+
[ora101,"BINARY_FLOAT", :binary_float, nil, true, false, 0, 4, 0, 0, 0, 0],
|
94
|
+
[ora101,"BINARY_DOUBLE", :binary_double, nil, true, false, 0, 8, 0, 0, 0, 0],
|
95
|
+
[ora80, "DATE", :date, nil, true, false, 0, 7, 0, 0, 0, 0],
|
82
96
|
|
83
97
|
# Don't check precision and lfprecision for TIMESTAMP
|
84
98
|
#
|
@@ -104,12 +118,12 @@ class TestMetadata < RUNIT::TestCase
|
|
104
118
|
# | TIMESTAMP(9) WITH LOCAL TIME ZONE | implicit | 0 | 0 |
|
105
119
|
# | | explicit | 9 | 9 |
|
106
120
|
# +-----------------------------------+----------+-----------+-------------+
|
107
|
-
[
|
108
|
-
[
|
109
|
-
[
|
110
|
-
[
|
111
|
-
[
|
112
|
-
[
|
121
|
+
[ora90, "TIMESTAMP", :timestamp, nil, true, false, 0, 11, :nc, 6, 6, :nc],
|
122
|
+
[ora90, "TIMESTAMP(9)", :timestamp, nil, true, false, 0, 11, :nc, 9, 9, :nc],
|
123
|
+
[ora90, "TIMESTAMP WITH TIME ZONE", :timestamp_tz, nil, true, false, 0, 13, :nc, 6, 6, :nc],
|
124
|
+
[ora90, "TIMESTAMP(9) WITH TIME ZONE", :timestamp_tz, nil, true, false, 0, 13, :nc, 9, 9, :nc],
|
125
|
+
[ora90, "TIMESTAMP WITH LOCAL TIME ZONE", :timestamp_ltz, nil, true, false, 0, 11, :nc, 6, 6, :nc],
|
126
|
+
[ora90, "TIMESTAMP(9) WITH LOCAL TIME ZONE", :timestamp_ltz, nil, true, false, 0, 11, :nc, 9, 9, :nc],
|
113
127
|
|
114
128
|
# Don't check scale and fsprecision for INTERVAL YEAR TO MONTH
|
115
129
|
#
|
@@ -123,8 +137,8 @@ class TestMetadata < RUNIT::TestCase
|
|
123
137
|
# | INTERVAL YEAR(4) TO MONTH | implicit | 0 | 0 |
|
124
138
|
# | | explicit | 4 | 4 |
|
125
139
|
# +------------------------------+----------+-----------+-------------+
|
126
|
-
[
|
127
|
-
[
|
140
|
+
[ora90, "INTERVAL YEAR TO MONTH", :interval_ym, nil, true, false, 0, 5, 2, :nc, :nc, 2],
|
141
|
+
[ora90, "INTERVAL YEAR(4) TO MONTH", :interval_ym, nil, true, false, 0, 5, 4, :nc, :nc, 4],
|
128
142
|
|
129
143
|
# Don't check precision and scale for INTERVAL DAY TO SECOND
|
130
144
|
#
|
@@ -138,15 +152,15 @@ class TestMetadata < RUNIT::TestCase
|
|
138
152
|
# | INTERVAL DAY(4) TO SECOND(9) | implicit | 4 | 9 |
|
139
153
|
# | | explicit | 9 | 4 |
|
140
154
|
# +------------------------------+----------+-----------+-----------+
|
141
|
-
[
|
142
|
-
[
|
155
|
+
[ora90, "INTERVAL DAY TO SECOND", :interval_ds, nil, true, false, 0, 11, :nc, :nc, 6, 2],
|
156
|
+
[ora90, "INTERVAL DAY(4) TO SECOND(9)",:interval_ds, nil, true, false, 0, 11, :nc, :nc, 9, 4],
|
143
157
|
]
|
144
158
|
|
145
159
|
coldef.reject! do |c| c[0] > $oracle_version end
|
146
160
|
|
147
161
|
drop_table('test_table')
|
148
162
|
sql = <<-EOS
|
149
|
-
CREATE TABLE test_table (#{
|
163
|
+
CREATE TABLE test_table (#{idx = 0; coldef.collect do |c| idx += 1; "C#{idx} " + c[1]; end.join(',')})
|
150
164
|
STORAGE (
|
151
165
|
INITIAL 100k
|
152
166
|
NEXT 100k
|
@@ -164,7 +178,7 @@ EOS
|
|
164
178
|
assert_equal(coldef[i][3], md.charset_form, "'#{coldef[i][1]}': charset_form")
|
165
179
|
assert_equal(coldef[i][4], md.nullable?, "'#{coldef[i][1]}': nullable? ")
|
166
180
|
# string type
|
167
|
-
if $oracle_version >=
|
181
|
+
if $oracle_version >= OCI8::ORAVER_9_0
|
168
182
|
assert_equal(coldef[i][5], md.char_used?, "'#{coldef[i][1]}': char_used? ")
|
169
183
|
assert_equal(coldef[i][6], md.char_size, "'#{coldef[i][1]}': char_size")
|
170
184
|
end
|
@@ -172,8 +186,10 @@ EOS
|
|
172
186
|
# number, timestamp and interval type
|
173
187
|
assert_equal(coldef[i][8], md.precision, "'#{coldef[i][1]}': precision") if coldef[i][8] != :nc
|
174
188
|
assert_equal(coldef[i][9], md.scale, "'#{coldef[i][1]}': scale") if coldef[i][9] != :nc
|
175
|
-
|
176
|
-
|
189
|
+
if $oracle_version >= OCI8::ORAVER_9_0
|
190
|
+
assert_equal(coldef[i][10], md.fsprecision, "'#{coldef[i][1]}': fsprecision") if coldef[i][10] != :nc
|
191
|
+
assert_equal(coldef[i][11], md.lfprecision, "'#{coldef[i][1]}': lfprecision") if coldef[i][11] != :nc
|
192
|
+
end
|
177
193
|
end
|
178
194
|
|
179
195
|
# temporarily change OCI8::BindType::Mapping.
|
@@ -200,7 +216,7 @@ EOS
|
|
200
216
|
assert_equal(coldef[i][3], md.charset_form, "'#{coldef[i][1]}': charset_form")
|
201
217
|
assert_equal(coldef[i][4], md.nullable?, "'#{coldef[i][1]}': nullable? ")
|
202
218
|
# string type
|
203
|
-
if $oracle_version >=
|
219
|
+
if $oracle_version >= OCI8::ORAVER_9_0
|
204
220
|
assert_equal(coldef[i][5], md.char_used?, "'#{coldef[i][1]}': char_used? ")
|
205
221
|
assert_equal(coldef[i][6], md.char_size, "'#{coldef[i][1]}': char_size")
|
206
222
|
end
|
@@ -208,8 +224,10 @@ EOS
|
|
208
224
|
# number, timestamp and interval type
|
209
225
|
assert_equal(coldef[i][8], md.precision, "'#{coldef[i][1]}': precision") if coldef[i][8] != :nc
|
210
226
|
assert_equal(coldef[i][9], md.scale, "'#{coldef[i][1]}': scale") if coldef[i][9] != :nc
|
211
|
-
|
212
|
-
|
227
|
+
if $oracle_version >= OCI8::ORAVER_9_0
|
228
|
+
assert_equal(coldef[i][10], md.fsprecision, "'#{coldef[i][1]}': fsprecision") if coldef[i][10] != :nc
|
229
|
+
assert_equal(coldef[i][11], md.lfprecision, "'#{coldef[i][1]}': lfprecision") if coldef[i][11] != :nc
|
230
|
+
end
|
213
231
|
end
|
214
232
|
|
215
233
|
drop_table('test_table')
|
@@ -219,17 +237,17 @@ EOS
|
|
219
237
|
drop_table('test_table')
|
220
238
|
begin
|
221
239
|
@conn.describe_table('test_table')
|
222
|
-
|
240
|
+
flunk("expects ORA-4043 but no error")
|
223
241
|
rescue OCIError
|
224
|
-
|
242
|
+
flunk("expects ORA-4043 but ORA-#{$!.code}") if $!.code != 4043
|
225
243
|
end
|
226
244
|
@conn.exec('create sequence test_table')
|
227
245
|
begin
|
228
246
|
begin
|
229
247
|
@conn.describe_table('test_table')
|
230
|
-
|
248
|
+
flunk('expects ORA-4043 but no error')
|
231
249
|
rescue OCIError
|
232
|
-
|
250
|
+
flunk("expects ORA-4043 but ORA-#{$!.code}") if $!.code != 4043
|
233
251
|
end
|
234
252
|
ensure
|
235
253
|
@conn.exec('drop sequence test_table')
|
@@ -237,7 +255,3 @@ EOS
|
|
237
255
|
end
|
238
256
|
|
239
257
|
end # TestMetadata
|
240
|
-
|
241
|
-
if $0 == __FILE__
|
242
|
-
RUNIT::CUI::TestRunner.run(TestMetadata.suite())
|
243
|
-
end
|