ruby-oci8 2.0.4-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1912 -0
- data/Makefile +96 -0
- data/NEWS +223 -0
- data/README +86 -0
- data/VERSION +1 -0
- data/dist-files +77 -0
- data/doc/api.en.html +527 -0
- data/doc/api.en.rd +554 -0
- data/doc/api.ja.html +525 -0
- data/doc/api.ja.rd +557 -0
- data/doc/manual.css +35 -0
- data/lib/.document +1 -0
- data/lib/dbd/OCI8.rb +591 -0
- data/lib/oci8.rb +82 -0
- data/lib/oci8.rb.in +82 -0
- data/lib/oci8/.document +5 -0
- data/lib/oci8/bindtype.rb +319 -0
- data/lib/oci8/compat.rb +113 -0
- data/lib/oci8/datetime.rb +619 -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 +562 -0
- data/lib/oci8/oci8.rb +571 -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 +142 -0
- data/pre-distclean.rb +7 -0
- data/ruby-oci8.gemspec +63 -0
- data/setup.rb +1331 -0
- data/test/README +4 -0
- data/test/config.rb +109 -0
- data/test/test_all.rb +50 -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_time.rb +178 -0
- data/test/test_break.rb +83 -0
- data/test/test_clob.rb +79 -0
- data/test/test_connstr.rb +81 -0
- data/test/test_datetime.rb +622 -0
- data/test/test_dbi.rb +366 -0
- data/test/test_dbi_clob.rb +53 -0
- data/test/test_encoding.rb +100 -0
- data/test/test_metadata.rb +257 -0
- data/test/test_oci8.rb +434 -0
- data/test/test_oracle_version.rb +70 -0
- data/test/test_oradate.rb +256 -0
- data/test/test_oranumber.rb +655 -0
- data/test/test_rowid.rb +33 -0
- metadata +108 -0
data/lib/oci8.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
# --*- ruby -*--
|
3
|
+
# This is based on yoshidam's oracle.rb.
|
4
|
+
#
|
5
|
+
# sample one liner:
|
6
|
+
# ruby -r oci8 -e 'OCI8.new("scott", "tiger", nil).exec("select * from emp") do |r| puts r.join(","); end'
|
7
|
+
# # select all data from emp and print them as CVS format.
|
8
|
+
|
9
|
+
if RUBY_PLATFORM =~ /cygwin/
|
10
|
+
# Cygwin manages environment variables by itself.
|
11
|
+
# They don't synchroize with Win32's ones.
|
12
|
+
# This set some Oracle's environment variables to win32's enviroment.
|
13
|
+
require 'Win32API'
|
14
|
+
win32setenv = Win32API.new('Kernel32.dll', 'SetEnvironmentVariableA', 'PP', 'I')
|
15
|
+
['NLS_LANG', 'ORA_NLS10', 'ORA_NLS32', 'ORA_NLS33', 'ORACLE_BASE', 'ORACLE_HOME', 'ORACLE_SID', 'TNS_ADMIN', 'LOCAL'].each do |name|
|
16
|
+
val = ENV[name]
|
17
|
+
win32setenv.call(name, val && val.dup)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
case RUBY_VERSION
|
22
|
+
when /^1\.9/
|
23
|
+
require 'oci8lib_191'
|
24
|
+
when /^1\.8/
|
25
|
+
require 'oci8lib_18'
|
26
|
+
else
|
27
|
+
raise 'unsupported ruby version: ' + RUBY_VERSION
|
28
|
+
end
|
29
|
+
|
30
|
+
if OCI8.respond_to? :encoding
|
31
|
+
if defined? DEFAULT_OCI8_ENCODING
|
32
|
+
OCI8.encoding = DEFAULT_OCI8_ENCODING
|
33
|
+
else
|
34
|
+
load 'oci8/encoding-init.rb'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'oci8/oracle_version.rb'
|
39
|
+
|
40
|
+
class OCI8
|
41
|
+
ORAVER_8_0 = OCI8::OracleVersion.new(8, 0)
|
42
|
+
ORAVER_8_1 = OCI8::OracleVersion.new(8, 1)
|
43
|
+
ORAVER_9_0 = OCI8::OracleVersion.new(9, 0)
|
44
|
+
ORAVER_9_2 = OCI8::OracleVersion.new(9, 2)
|
45
|
+
ORAVER_10_1 = OCI8::OracleVersion.new(10, 1)
|
46
|
+
ORAVER_10_2 = OCI8::OracleVersion.new(10, 2)
|
47
|
+
ORAVER_11_1 = OCI8::OracleVersion.new(11, 1)
|
48
|
+
|
49
|
+
@@oracle_client_version = OCI8::OracleVersion.new(self.oracle_client_vernum)
|
50
|
+
|
51
|
+
# :call-seq:
|
52
|
+
# OCI8.oracle_client_version -> oraver
|
53
|
+
#
|
54
|
+
# Returns an OCI8::OracleVersion of the Oracle client version.
|
55
|
+
#
|
56
|
+
# If this library is configured without '--with-runtime-check',
|
57
|
+
# and compiled for Oracle 10.1 or lower, the major and minor
|
58
|
+
# numbers are determined at compile-time. The rests are zeros.
|
59
|
+
#
|
60
|
+
# If this library is configured with '--with-runtime-check'
|
61
|
+
# and the runtime Oracle library is Oracle 10.1 or lower, the
|
62
|
+
# major and minor numbers are determined at run-time. The
|
63
|
+
# rests are zeros.
|
64
|
+
#
|
65
|
+
# Otherwise, it is the version retrieved from an OCI function
|
66
|
+
# OCIClientVersion().
|
67
|
+
def self.oracle_client_version
|
68
|
+
@@oracle_client_version
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
require 'oci8/datetime.rb'
|
73
|
+
require 'oci8/oci8.rb'
|
74
|
+
require 'oci8/bindtype.rb'
|
75
|
+
require 'oci8/metadata.rb'
|
76
|
+
require 'oci8/compat.rb'
|
77
|
+
require 'oci8/object.rb'
|
78
|
+
|
79
|
+
class OCI8
|
80
|
+
VERSION = '2.0.4'
|
81
|
+
CLIENT_VERSION = '1020'
|
82
|
+
end
|
data/lib/oci8.rb.in
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
# --*- ruby -*--
|
3
|
+
# This is based on yoshidam's oracle.rb.
|
4
|
+
#
|
5
|
+
# sample one liner:
|
6
|
+
# ruby -r oci8 -e 'OCI8.new("scott", "tiger", nil).exec("select * from emp") do |r| puts r.join(","); end'
|
7
|
+
# # select all data from emp and print them as CVS format.
|
8
|
+
|
9
|
+
if RUBY_PLATFORM =~ /cygwin/
|
10
|
+
# Cygwin manages environment variables by itself.
|
11
|
+
# They don't synchroize with Win32's ones.
|
12
|
+
# This set some Oracle's environment variables to win32's enviroment.
|
13
|
+
require 'Win32API'
|
14
|
+
win32setenv = Win32API.new('Kernel32.dll', 'SetEnvironmentVariableA', 'PP', 'I')
|
15
|
+
['NLS_LANG', 'ORA_NLS10', 'ORA_NLS32', 'ORA_NLS33', 'ORACLE_BASE', 'ORACLE_HOME', 'ORACLE_SID', 'TNS_ADMIN', 'LOCAL'].each do |name|
|
16
|
+
val = ENV[name]
|
17
|
+
win32setenv.call(name, val && val.dup)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
case RUBY_VERSION
|
22
|
+
when /^1\.9/
|
23
|
+
require 'oci8lib_191'
|
24
|
+
when /^1\.8/
|
25
|
+
require 'oci8lib_18'
|
26
|
+
else
|
27
|
+
raise 'unsupported ruby version: ' + RUBY_VERSION
|
28
|
+
end
|
29
|
+
|
30
|
+
if OCI8.respond_to? :encoding
|
31
|
+
if defined? DEFAULT_OCI8_ENCODING
|
32
|
+
OCI8.encoding = DEFAULT_OCI8_ENCODING
|
33
|
+
else
|
34
|
+
load 'oci8/encoding-init.rb'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'oci8/oracle_version.rb'
|
39
|
+
|
40
|
+
class OCI8
|
41
|
+
ORAVER_8_0 = OCI8::OracleVersion.new(8, 0)
|
42
|
+
ORAVER_8_1 = OCI8::OracleVersion.new(8, 1)
|
43
|
+
ORAVER_9_0 = OCI8::OracleVersion.new(9, 0)
|
44
|
+
ORAVER_9_2 = OCI8::OracleVersion.new(9, 2)
|
45
|
+
ORAVER_10_1 = OCI8::OracleVersion.new(10, 1)
|
46
|
+
ORAVER_10_2 = OCI8::OracleVersion.new(10, 2)
|
47
|
+
ORAVER_11_1 = OCI8::OracleVersion.new(11, 1)
|
48
|
+
|
49
|
+
@@oracle_client_version = OCI8::OracleVersion.new(self.oracle_client_vernum)
|
50
|
+
|
51
|
+
# :call-seq:
|
52
|
+
# OCI8.oracle_client_version -> oraver
|
53
|
+
#
|
54
|
+
# Returns an OCI8::OracleVersion of the Oracle client version.
|
55
|
+
#
|
56
|
+
# If this library is configured without '--with-runtime-check',
|
57
|
+
# and compiled for Oracle 10.1 or lower, the major and minor
|
58
|
+
# numbers are determined at compile-time. The rests are zeros.
|
59
|
+
#
|
60
|
+
# If this library is configured with '--with-runtime-check'
|
61
|
+
# and the runtime Oracle library is Oracle 10.1 or lower, the
|
62
|
+
# major and minor numbers are determined at run-time. The
|
63
|
+
# rests are zeros.
|
64
|
+
#
|
65
|
+
# Otherwise, it is the version retrieved from an OCI function
|
66
|
+
# OCIClientVersion().
|
67
|
+
def self.oracle_client_version
|
68
|
+
@@oracle_client_version
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
require 'oci8/datetime.rb'
|
73
|
+
require 'oci8/oci8.rb'
|
74
|
+
require 'oci8/bindtype.rb'
|
75
|
+
require 'oci8/metadata.rb'
|
76
|
+
require 'oci8/compat.rb'
|
77
|
+
require 'oci8/object.rb'
|
78
|
+
|
79
|
+
class OCI8
|
80
|
+
VERSION = '@@OCI8_MODULE_VERSION@@'
|
81
|
+
CLIENT_VERSION = '@@OCI8_CLIENT_VERSION@@'
|
82
|
+
end
|
data/lib/oci8/.document
ADDED
@@ -0,0 +1,319 @@
|
|
1
|
+
#--
|
2
|
+
# bindtype.rb -- OCI8::BindType
|
3
|
+
#
|
4
|
+
# Copyright (C) 2009 KUBO Takehiro <kubo@jiubao.org>
|
5
|
+
#++
|
6
|
+
|
7
|
+
class OCI8
|
8
|
+
module BindType
|
9
|
+
Mapping = {}
|
10
|
+
|
11
|
+
class Base
|
12
|
+
def self.create(con, val, param, max_array_size)
|
13
|
+
self.new(con, val, param, max_array_size)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# get/set Date
|
18
|
+
class Date < OCI8::BindType::OraDate
|
19
|
+
def set(val)
|
20
|
+
super(val && ::OraDate.new(val.year, val.mon, val.mday))
|
21
|
+
end
|
22
|
+
def get()
|
23
|
+
(val = super()) && val.to_date
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class BigDecimal < OCI8::BindType::OraNumber
|
28
|
+
@@bigdecimal_is_required = false
|
29
|
+
def get()
|
30
|
+
unless @@bigdecimal_is_required
|
31
|
+
require 'bigdecimal'
|
32
|
+
@@bigdecimal_is_required = true
|
33
|
+
end
|
34
|
+
(val = super()) && val.to_d
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Rational < OCI8::BindType::OraNumber
|
39
|
+
@@rational_is_required = false
|
40
|
+
def get()
|
41
|
+
unless @@rational_is_required
|
42
|
+
require 'rational'
|
43
|
+
@@rational_is_required = true
|
44
|
+
end
|
45
|
+
(val = super()) && val.to_r
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# get/set Number (for OCI8::SQLT_NUM)
|
50
|
+
class Number
|
51
|
+
def self.create(con, val, param, max_array_size)
|
52
|
+
if param.is_a? OCI8::Metadata::Base
|
53
|
+
precision = param.precision
|
54
|
+
scale = param.scale
|
55
|
+
end
|
56
|
+
if scale == -127
|
57
|
+
if precision == 0
|
58
|
+
# NUMBER declared without its scale and precision. (Oracle 9.2.0.3 or above)
|
59
|
+
klass = OCI8::BindType::Mapping[:number_no_prec_setting]
|
60
|
+
else
|
61
|
+
# FLOAT or FLOAT(p)
|
62
|
+
klass = OCI8::BindType::Float
|
63
|
+
end
|
64
|
+
elsif scale == 0
|
65
|
+
if precision == 0
|
66
|
+
# NUMBER whose scale and precision is unknown
|
67
|
+
# or
|
68
|
+
# NUMBER declared without its scale and precision. (Oracle 9.2.0.2 or below)
|
69
|
+
klass = OCI8::BindType::Mapping[:number_unknown_prec]
|
70
|
+
else
|
71
|
+
# NUMBER(p, 0)
|
72
|
+
klass = OCI8::BindType::Integer
|
73
|
+
end
|
74
|
+
else
|
75
|
+
# NUMBER(p, s)
|
76
|
+
if precision < 15 # the precision of double.
|
77
|
+
klass = OCI8::BindType::Float
|
78
|
+
else
|
79
|
+
# use BigDecimal instead
|
80
|
+
klass = OCI8::BindType::BigDecimal
|
81
|
+
end
|
82
|
+
end
|
83
|
+
klass.new(con, val, nil, max_array_size)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
class String
|
88
|
+
# 1333 <= ceil(4000 / 3). 4000 is max size of char. 3 is NLS ratio of UTF-8.
|
89
|
+
@@minimum_bind_length = 1333
|
90
|
+
|
91
|
+
def self.minimum_bind_length
|
92
|
+
@@minimum_bind_length
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.minimum_bind_length=(val)
|
96
|
+
@@minimum_bind_length = val
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.create(con, val, param, max_array_size)
|
100
|
+
case param
|
101
|
+
when Hash
|
102
|
+
if param[:length]
|
103
|
+
# If length is passed explicitly, use it.
|
104
|
+
length = param[:length]
|
105
|
+
elsif val.is_a? String or (val.respond_to? :to_str and val = val.to_str)
|
106
|
+
if OCI8.respond_to? :encoding and OCI8.encoding != val.encoding
|
107
|
+
# If the string encoding is different with NLS_LANG character set,
|
108
|
+
# convert it to get the length.
|
109
|
+
val = val.encode(OCI8.encoding)
|
110
|
+
end
|
111
|
+
if val.respond_to? :bytesize
|
112
|
+
# ruby 1.8.7 or upper
|
113
|
+
length = val.bytesize
|
114
|
+
else
|
115
|
+
# ruby 1.8.6 or lower
|
116
|
+
length = val.size
|
117
|
+
end
|
118
|
+
end
|
119
|
+
when OCI8::Metadata::Base
|
120
|
+
case param.data_type
|
121
|
+
when :char, :varchar2
|
122
|
+
length = param.data_size
|
123
|
+
# character size may become large on character set conversion.
|
124
|
+
# The length of a Japanese half-width kana is one in Shift_JIS,
|
125
|
+
# two in EUC-JP, three in UTF-8.
|
126
|
+
length *= 3 unless param.char_used?
|
127
|
+
when :raw
|
128
|
+
# HEX needs twice space.
|
129
|
+
length = param.data_size * 2
|
130
|
+
end
|
131
|
+
end
|
132
|
+
length = @@minimum_bind_length if length.nil? or length < @@minimum_bind_length
|
133
|
+
self.new(con, val, length, max_array_size)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
class RAW
|
138
|
+
def self.create(con, val, param, max_array_size)
|
139
|
+
case param
|
140
|
+
when Hash
|
141
|
+
length = 400 # default length
|
142
|
+
if param[:length]
|
143
|
+
length = param[:length]
|
144
|
+
elsif val.respond_to? :to_str and val.to_str.size > length
|
145
|
+
length = val.to_str.size
|
146
|
+
end
|
147
|
+
when OCI8::Metadata::Base
|
148
|
+
length = param.data_size
|
149
|
+
end
|
150
|
+
self.new(con, val, length, max_array_size)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
class Long < OCI8::BindType::String
|
155
|
+
def self.create(con, val, param, max_array_size)
|
156
|
+
self.new(con, val, con.long_read_len, max_array_size)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
class LongRaw < OCI8::BindType::RAW
|
161
|
+
def self.create(con, val, param, max_array_size)
|
162
|
+
self.new(con, val, con.long_read_len, max_array_size)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
class CLOB
|
167
|
+
def self.create(con, val, param, max_array_size)
|
168
|
+
if param.is_a? OCI8::Metadata::Base and param.charset_form == :nchar
|
169
|
+
OCI8::BindType::NCLOB.new(con, val, nil, max_array_size)
|
170
|
+
else
|
171
|
+
OCI8::BindType::CLOB.new(con, val, nil, max_array_size)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end # BindType
|
176
|
+
end
|
177
|
+
|
178
|
+
# bind or explicitly define
|
179
|
+
OCI8::BindType::Mapping[String] = OCI8::BindType::String
|
180
|
+
OCI8::BindType::Mapping[OraNumber] = OCI8::BindType::OraNumber
|
181
|
+
OCI8::BindType::Mapping['BigDecimal'] = OCI8::BindType::BigDecimal
|
182
|
+
OCI8::BindType::Mapping['Rational'] = OCI8::BindType::Rational
|
183
|
+
OCI8::BindType::Mapping[Fixnum] = OCI8::BindType::Integer
|
184
|
+
OCI8::BindType::Mapping[Float] = OCI8::BindType::Float
|
185
|
+
OCI8::BindType::Mapping[Integer] = OCI8::BindType::Integer
|
186
|
+
OCI8::BindType::Mapping[Bignum] = OCI8::BindType::Integer
|
187
|
+
OCI8::BindType::Mapping[OraDate] = OCI8::BindType::OraDate
|
188
|
+
OCI8::BindType::Mapping[Time] = OCI8::BindType::Time
|
189
|
+
OCI8::BindType::Mapping[Date] = OCI8::BindType::Date
|
190
|
+
OCI8::BindType::Mapping[DateTime] = OCI8::BindType::DateTime
|
191
|
+
OCI8::BindType::Mapping[OCI8::CLOB] = OCI8::BindType::CLOB
|
192
|
+
OCI8::BindType::Mapping[OCI8::NCLOB] = OCI8::BindType::NCLOB
|
193
|
+
OCI8::BindType::Mapping[OCI8::BLOB] = OCI8::BindType::BLOB
|
194
|
+
OCI8::BindType::Mapping[OCI8::BFILE] = OCI8::BindType::BFILE
|
195
|
+
OCI8::BindType::Mapping[OCI8::Cursor] = OCI8::BindType::Cursor
|
196
|
+
|
197
|
+
# implicitly define
|
198
|
+
|
199
|
+
# datatype type size prec scale
|
200
|
+
# -------------------------------------------------
|
201
|
+
# CHAR(1) SQLT_AFC 1 0 0
|
202
|
+
# CHAR(10) SQLT_AFC 10 0 0
|
203
|
+
OCI8::BindType::Mapping[:char] = OCI8::BindType::String
|
204
|
+
|
205
|
+
# datatype type size prec scale
|
206
|
+
# -------------------------------------------------
|
207
|
+
# VARCHAR(1) SQLT_CHR 1 0 0
|
208
|
+
# VARCHAR(10) SQLT_CHR 10 0 0
|
209
|
+
# VARCHAR2(1) SQLT_CHR 1 0 0
|
210
|
+
# VARCHAR2(10) SQLT_CHR 10 0 0
|
211
|
+
OCI8::BindType::Mapping[:varchar2] = OCI8::BindType::String
|
212
|
+
|
213
|
+
# datatype type size prec scale
|
214
|
+
# -------------------------------------------------
|
215
|
+
# RAW(1) SQLT_BIN 1 0 0
|
216
|
+
# RAW(10) SQLT_BIN 10 0 0
|
217
|
+
OCI8::BindType::Mapping[:raw] = OCI8::BindType::RAW
|
218
|
+
|
219
|
+
# datatype type size prec scale
|
220
|
+
# -------------------------------------------------
|
221
|
+
# LONG SQLT_LNG 0 0 0
|
222
|
+
OCI8::BindType::Mapping[:long] = OCI8::BindType::Long
|
223
|
+
|
224
|
+
# datatype type size prec scale
|
225
|
+
# -------------------------------------------------
|
226
|
+
# LONG RAW SQLT_LBI 0 0 0
|
227
|
+
OCI8::BindType::Mapping[:long_raw] = OCI8::BindType::LongRaw
|
228
|
+
|
229
|
+
# datatype type size prec scale
|
230
|
+
# -------------------------------------------------
|
231
|
+
# CLOB SQLT_CLOB 4000 0 0
|
232
|
+
OCI8::BindType::Mapping[:clob] = OCI8::BindType::CLOB
|
233
|
+
OCI8::BindType::Mapping[:nclob] = OCI8::BindType::NCLOB
|
234
|
+
|
235
|
+
# datatype type size prec scale
|
236
|
+
# -------------------------------------------------
|
237
|
+
# BLOB SQLT_BLOB 4000 0 0
|
238
|
+
OCI8::BindType::Mapping[:blob] = OCI8::BindType::BLOB
|
239
|
+
|
240
|
+
# datatype type size prec scale
|
241
|
+
# -------------------------------------------------
|
242
|
+
# BFILE SQLT_BFILE 4000 0 0
|
243
|
+
OCI8::BindType::Mapping[:bfile] = OCI8::BindType::BFILE
|
244
|
+
|
245
|
+
# datatype type size prec scale
|
246
|
+
# -------------------------------------------------
|
247
|
+
# DATE SQLT_DAT 7 0 0
|
248
|
+
OCI8::BindType::Mapping[:date] = OCI8::BindType::Time
|
249
|
+
|
250
|
+
if OCI8.oracle_client_version >= OCI8::ORAVER_9_0
|
251
|
+
OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::Time
|
252
|
+
OCI8::BindType::Mapping[:timestamp_tz] = OCI8::BindType::Time
|
253
|
+
OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::Time
|
254
|
+
OCI8::BindType::Mapping[:interval_ym] = OCI8::BindType::IntervalYM
|
255
|
+
OCI8::BindType::Mapping[:interval_ds] = OCI8::BindType::IntervalDS
|
256
|
+
end
|
257
|
+
|
258
|
+
# datatype type size prec scale
|
259
|
+
# -------------------------------------------------
|
260
|
+
# ROWID SQLT_RDD 4 0 0
|
261
|
+
OCI8::BindType::Mapping[:rowid] = OCI8::BindType::String
|
262
|
+
|
263
|
+
# datatype type size prec scale
|
264
|
+
# -----------------------------------------------------
|
265
|
+
# FLOAT SQLT_NUM 22 126 -127
|
266
|
+
# FLOAT(1) SQLT_NUM 22 1 -127
|
267
|
+
# FLOAT(126) SQLT_NUM 22 126 -127
|
268
|
+
# DOUBLE PRECISION SQLT_NUM 22 126 -127
|
269
|
+
# REAL SQLT_NUM 22 63 -127
|
270
|
+
# NUMBER SQLT_NUM 22 0 0
|
271
|
+
# NUMBER(1) SQLT_NUM 22 1 0
|
272
|
+
# NUMBER(38) SQLT_NUM 22 38 0
|
273
|
+
# NUMBER(1, 0) SQLT_NUM 22 1 0
|
274
|
+
# NUMBER(38, 0) SQLT_NUM 22 38 0
|
275
|
+
# NUMERIC SQLT_NUM 22 38 0
|
276
|
+
# INT SQLT_NUM 22 38 0
|
277
|
+
# INTEGER SQLT_NUM 22 38 0
|
278
|
+
# SMALLINT SQLT_NUM 22 38 0
|
279
|
+
OCI8::BindType::Mapping[:number] = OCI8::BindType::Number
|
280
|
+
|
281
|
+
# mapping for calculated number values.
|
282
|
+
#
|
283
|
+
# for example:
|
284
|
+
# select col1 * 1.1 from tab1;
|
285
|
+
#
|
286
|
+
# For Oracle 9.2.0.2 or below, this is also used for NUMBER
|
287
|
+
# datatypes that have no explicit setting of their precision
|
288
|
+
# and scale.
|
289
|
+
#
|
290
|
+
# The default mapping is Float for ruby-oci8 1.0, OraNumber for 2.0.0 ~ 2.0.2,
|
291
|
+
# BigDecimal for 2.0.3 ~.
|
292
|
+
OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::BigDecimal
|
293
|
+
|
294
|
+
# mapping for number without precision and scale.
|
295
|
+
#
|
296
|
+
# for example:
|
297
|
+
# create table tab1 (col1 number);
|
298
|
+
# select col1 from tab1;
|
299
|
+
#
|
300
|
+
# note: This is available only on Oracle 9.2.0.3 or above.
|
301
|
+
# see: Oracle 9.2.0.x Patch Set Notes.
|
302
|
+
#
|
303
|
+
# The default mapping is Float for ruby-oci8 1.0, OraNumber for 2.0.0 ~ 2.0.2,
|
304
|
+
# BigDecimal for 2.0.3 ~.
|
305
|
+
OCI8::BindType::Mapping[:number_no_prec_setting] = OCI8::BindType::BigDecimal
|
306
|
+
|
307
|
+
if defined? OCI8::BindType::BinaryDouble
|
308
|
+
OCI8::BindType::Mapping[:binary_float] = OCI8::BindType::BinaryDouble
|
309
|
+
OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::BinaryDouble
|
310
|
+
else
|
311
|
+
OCI8::BindType::Mapping[:binary_float] = OCI8::BindType::Float
|
312
|
+
OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::Float
|
313
|
+
end
|
314
|
+
|
315
|
+
# Cursor
|
316
|
+
OCI8::BindType::Mapping[:cursor] = OCI8::BindType::Cursor
|
317
|
+
|
318
|
+
# XMLType (This mapping will be changed before release.)
|
319
|
+
OCI8::BindType::Mapping[:xmltype] = OCI8::BindType::Long
|