ruby-oci8 1.0.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1254 -390
- data/Makefile +10 -13
- data/README +56 -385
- data/VERSION +1 -1
- data/dist-files +26 -27
- data/ext/oci8/.document +1 -0
- data/ext/oci8/MANIFEST +0 -4
- data/ext/oci8/apiwrap.c.tmpl +172 -0
- data/ext/oci8/apiwrap.h.tmpl +61 -0
- data/ext/oci8/apiwrap.rb +91 -0
- data/ext/oci8/apiwrap.yml +1243 -0
- data/ext/oci8/attr.c +124 -384
- data/ext/oci8/bind.c +472 -164
- data/ext/oci8/encoding.c +196 -0
- data/ext/oci8/env.c +84 -253
- data/ext/oci8/error.c +196 -127
- data/ext/oci8/extconf.rb +82 -59
- data/ext/oci8/lob.c +710 -370
- data/ext/oci8/metadata.c +359 -0
- data/ext/oci8/object.c +622 -0
- data/ext/oci8/oci8.c +577 -161
- data/ext/oci8/oci8.h +354 -258
- data/ext/oci8/oci8lib.c +493 -0
- data/ext/oci8/ocidatetime.c +473 -0
- data/ext/oci8/ocinumber.c +1123 -24
- data/ext/oci8/oraconf.rb +72 -106
- data/ext/oci8/oradate.c +511 -321
- data/ext/oci8/stmt.c +752 -572
- data/ext/oci8/win32.c +131 -0
- data/ext/oci8/xmldb.c +383 -0
- data/lib/.document +2 -0
- data/lib/dbd/OCI8.rb +2 -17
- data/lib/oci8.rb.in +41 -1622
- data/lib/oci8/.document +5 -0
- data/lib/oci8/compat.rb +108 -0
- data/lib/oci8/datetime.rb +489 -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 +773 -0
- data/lib/oci8/oracle_version.rb +144 -0
- data/metaconfig +3 -3
- data/ruby-oci8.gemspec +5 -5
- data/setup.rb +4 -4
- data/test/config.rb +64 -84
- data/test/test_all.rb +14 -21
- data/test/test_array_dml.rb +317 -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 +31 -32
- data/NEWS +0 -420
- data/ext/oci8/const.c +0 -165
- data/ext/oci8/define.c +0 -53
- data/ext/oci8/describe.c +0 -81
- data/ext/oci8/descriptor.c +0 -39
- data/ext/oci8/handle.c +0 -273
- data/ext/oci8/oranumber.c +0 -445
- data/ext/oci8/param.c +0 -37
- data/ext/oci8/server.c +0 -182
- data/ext/oci8/session.c +0 -99
- data/ext/oci8/svcctx.c +0 -238
- 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/Makefile
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
VERSION = `cat VERSION`
|
2
|
-
RUBY = ruby
|
3
|
-
GEM = gem
|
4
|
-
CONFIG_OPT =
|
2
|
+
RUBY = ruby -w
|
5
3
|
|
6
4
|
all: build
|
7
5
|
|
8
6
|
build: config.save setup
|
9
7
|
|
10
8
|
config.save: lib/oci8.rb.in
|
11
|
-
$(RUBY) setup.rb config
|
9
|
+
$(RUBY) setup.rb config
|
12
10
|
|
13
11
|
setup:
|
14
12
|
$(RUBY) setup.rb setup
|
@@ -28,14 +26,16 @@ install:
|
|
28
26
|
site-install:
|
29
27
|
$(RUBY) setup.rb install
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
binary_gem: build
|
35
|
-
$(GEM) build ruby-oci8.gemspec -- current
|
29
|
+
format_c_source:
|
30
|
+
astyle --options=none --style=linux --indent=spaces=4 --brackets=linux --suffix=none ext/oci8/*.[ch]
|
36
31
|
|
37
32
|
# internal use only
|
38
|
-
|
33
|
+
.PHONY: rdoc
|
34
|
+
|
35
|
+
rdoc:
|
36
|
+
$(RUBY) custom-rdoc.rb -o rdoc -U README ext/oci8 lib
|
37
|
+
|
38
|
+
dist:
|
39
39
|
-rm -rf ruby-oci8-$(VERSION)
|
40
40
|
mkdir ruby-oci8-$(VERSION)
|
41
41
|
tar cf - `cat dist-files` | (cd ruby-oci8-$(VERSION); tar xf - )
|
@@ -46,6 +46,3 @@ dist-check: dist
|
|
46
46
|
cd ruby-oci8-$(VERSION) && $(MAKE) RUBY="$(RUBY)" check
|
47
47
|
cd ruby-oci8-$(VERSION)/src && $(MAKE) RUBY="$(RUBY)" sitearchdir=../work sitelibdir=../work site-install
|
48
48
|
cd ruby-oci8-$(VERSION)/test && $(RUBY) -I../work -I../support test_all.rb
|
49
|
-
|
50
|
-
ruby-oci8.spec: ruby-oci8.spec.in
|
51
|
-
$(RUBY) -rerb -e "open('ruby-oci8.spec', 'w').write(ERB.new(open('ruby-oci8.spec.in').read).result)"
|
data/README
CHANGED
@@ -1,415 +1,86 @@
|
|
1
1
|
= How to make
|
2
2
|
|
3
|
-
|
3
|
+
* <tt>ruby</tt> and <tt>make</tt> (or nmake on MSVC) commands in the environment variable <tt>PATH</tt>?
|
4
|
+
* <tt>ruby</tt> is 1.8.0 or later? (Use ruby-oci8 0.1.x for ruby 1.6.x.)
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
== For OCI installed by Oracle Universal Installer
|
7
|
+
make sure the environment variable ORACLE_HOME (or registry on Windows)
|
8
|
+
is set correctly. run the the following commands.
|
8
9
|
|
9
|
-
|
10
|
+
make (or nmake on MSVC)
|
10
11
|
|
11
|
-
|
12
|
-
But if Oracle is 64-bit and ruby is 32-bit, make sure $ORACLE_HOME/lib32
|
13
|
-
in 32-bit library search path. (LD_LIBRARY_PATH_32 on Solaris, SHLIB_PATH
|
14
|
-
on HP-UX PA-RISC.)
|
12
|
+
== For OCI installed by Oracle Instant Installer
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
make # or nmake on MSVC.
|
20
|
-
make install
|
14
|
+
linux:
|
15
|
+
ruby setup.rb config -- --with-instant-client
|
16
|
+
make
|
21
17
|
|
22
|
-
|
18
|
+
others:
|
19
|
+
ruby setup.rb config -- --with-instant-client=/path/to/instantclient10_1
|
20
|
+
make (or nmake on MSVC)
|
23
21
|
|
24
|
-
|
22
|
+
= On compilation failure
|
25
23
|
|
26
|
-
|
27
|
-
URL:http://otn.oracle.com/
|
28
|
-
Instant Client Donload Page:
|
29
|
-
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
|
24
|
+
Please report the following information to kubo@jiubao.org.
|
30
25
|
|
31
|
-
|
32
|
-
|
26
|
+
* last 100 lines of 'ext/oci8/mkmf.log'.
|
27
|
+
* the results of the following commands:
|
28
|
+
ruby -r rbconfig -e "p Config::CONFIG['host']"
|
29
|
+
ruby -r rbconfig -e "p Config::CONFIG['CC']"
|
30
|
+
ruby -r rbconfig -e "p Config::CONFIG['CFLAGS']"
|
31
|
+
ruby -r rbconfig -e "p Config::CONFIG['LDSHARED']"
|
32
|
+
ruby -r rbconfig -e "p Config::CONFIG['LDFLAGS']"
|
33
|
+
ruby -r rbconfig -e "p Config::CONFIG['LIBS']"
|
34
|
+
ruby -r rbconfig -e "p Config::CONFIG['GNU_LD']"
|
35
|
+
* if you use gcc:
|
36
|
+
gcc --print-prog-name=ld
|
37
|
+
gcc --print-prog-name=as
|
38
|
+
* on platforms which can use both 32bit/64bit binaries:
|
39
|
+
file $ORACLE_HOME/bin/oracle
|
40
|
+
file `which ruby`
|
41
|
+
echo $LD_LIBRARY_PATH
|
33
42
|
|
34
|
-
|
43
|
+
= How to run unit test
|
35
44
|
|
36
|
-
|
45
|
+
before runing unit test,
|
46
|
+
1. connect to Oracle as system:
|
37
47
|
|
38
|
-
|
39
|
-
mkdir /opt/oracle
|
40
|
-
cd /opt/oracle
|
41
|
-
unzip path/to/instantclient-basic-XXXX-10.1.0.X.zip
|
42
|
-
unzip path/to/instantclient-sdk-XXXX-10.1.0.X.zip
|
48
|
+
$ sqlplus system/<password_of_system>
|
43
49
|
|
44
|
-
|
50
|
+
2. create user ruby:
|
45
51
|
|
46
|
-
|
47
|
-
rpm -i path/to/oracle-instantclient-devel-10.1.0.X-X.XXX.rpm
|
52
|
+
SQL> CREATE USER ruby IDENTIFIED BY oci8;
|
48
53
|
|
49
|
-
note for Debian user:
|
50
|
-
convert rpm packages to deb packages by alien.
|
51
|
-
alien path/to/oracle-instantclient-basic-10.1.0.X-X.XXX.rpm
|
52
|
-
alien path/to/oracle-instantclient-devel-10.1.0.X-X.XXX.rpm
|
53
|
-
dpkg -i oracle-instantclient-basic_10.1.0.X-X_XXX.deb
|
54
|
-
dpkg -i oracle-instantclient-devel_10.1.0.X-X_XXX.deb
|
55
|
-
|
56
|
-
3. check installed libraries. (UNIX zip packages only)
|
57
|
-
|
58
|
-
If /opt/oracle/instantclient10_1/libclntsh.so not found,
|
59
|
-
make a symbolic link.
|
60
|
-
|
61
|
-
cd /opt/oracle/instantclient10_1
|
62
|
-
ln -s libclntsh.so.10.1 libclntsh.so
|
63
|
-
|
64
|
-
note:
|
65
|
-
libclntsh.sl for HP-UX PA-RISC
|
66
|
-
libclntsh.dylib for Mac OS X
|
67
|
-
|
68
|
-
4. set library search path.
|
69
|
-
|
70
|
-
Windows:
|
71
|
-
add c:\oracle\instantclient10_1 to PATH.
|
72
|
-
|
73
|
-
AIX:
|
74
|
-
add /opt/oracle/instantclient10_1 to LIBPATH.
|
75
|
-
|
76
|
-
HP-UX PA-RISC 32-bit ruby:
|
77
|
-
add /opt/oracle/instantclient10_1 to SHLIB_PATH.
|
78
|
-
|
79
|
-
SPARC/Solaris 32-bit ruby:
|
80
|
-
add /opt/oracle/instantclient10_1 to LD_LIBRARY_PATH_32.
|
81
|
-
|
82
|
-
SPARC/Solaris 64-bit ruby:
|
83
|
-
add /opt/oracle/instantclient10_1 to LD_LIBRARY_PATH_64.
|
84
|
-
|
85
|
-
Mac OS X:
|
86
|
-
add /opt/oracle/instantclient10_1 to DYLD_LIBRARY_PATH.
|
87
|
-
|
88
|
-
Others:
|
89
|
-
add /opt/oracle/instantclient10_1 to LD_LIBRARY_PATH.
|
90
|
-
|
91
|
-
5. make and install.
|
92
|
-
|
93
|
-
zip packages:
|
94
|
-
gzip -dc ruby-oci8-0.1.xx.tar.gz | tar xvf -
|
95
|
-
cd ruby-oci8-0.1.xx
|
96
|
-
ruby setup.rb config -- --with-instant-client=/opt/oracle/instantclient10_1
|
97
|
-
make
|
98
|
-
make install
|
99
|
-
|
100
|
-
rpm packages:
|
101
|
-
gzip -dc ruby-oci8-0.1.xx.tar.gz | tar xvf -
|
102
|
-
cd ruby-oci8-0.1.xx
|
103
|
-
ruby setup.rb config -- --with-instant-client
|
104
|
-
make
|
105
|
-
make install
|
106
|
-
|
107
|
-
== On compilation failure
|
108
|
-
|
109
|
-
Please report the following information to kubo@jiubao.org.
|
110
|
-
|
111
|
-
* last 100 lines of 'ext/oci8/mkmf.log'.
|
112
|
-
* the results of the following commands:
|
113
|
-
ruby --version
|
114
|
-
ruby -r rbconfig -e "p Config::CONFIG['host']"
|
115
|
-
ruby -r rbconfig -e "p Config::CONFIG['CC']"
|
116
|
-
ruby -r rbconfig -e "p Config::CONFIG['CFLAGS']"
|
117
|
-
ruby -r rbconfig -e "p Config::CONFIG['LDSHARED']"
|
118
|
-
ruby -r rbconfig -e "p Config::CONFIG['LDFLAGS']"
|
119
|
-
ruby -r rbconfig -e "p Config::CONFIG['DLDLAGS']"
|
120
|
-
ruby -r rbconfig -e "p Config::CONFIG['LIBS']"
|
121
|
-
ruby -r rbconfig -e "p Config::CONFIG['GNU_LD']"
|
122
|
-
* if you use gcc:
|
123
|
-
gcc --print-prog-name=ld
|
124
|
-
gcc --print-prog-name=as
|
125
|
-
* on platforms which can use both 32bit/64bit binaries:
|
126
|
-
file $ORACLE_HOME/bin/oracle # Full Client only
|
127
|
-
file `which ruby`
|
128
|
-
echo $LD_LIBRARY_PATH
|
129
|
-
echo $LIBPATH # AIX
|
130
|
-
echo $SHLIB_PATH # HP-UX PA-RISC
|
131
|
-
echo $DYLD_LIBRARY_PATH # Mac OS X
|
132
|
-
echo $LD_LIBRARY_PATH_32 # Solaris
|
133
|
-
|
134
|
-
= How to run
|
135
|
-
|
136
|
-
== Oracle Full Client (not Oracle Instant Client)
|
137
|
-
|
138
|
-
1. set environmet variables.
|
139
|
-
|
140
|
-
The follwing environmet variables are required:
|
141
|
-
|
142
|
-
* ORACLE_HOME
|
143
|
-
UNIX only. This variable is set on registry on Windows.
|
144
|
-
|
145
|
-
* NLS_LANG
|
146
|
-
UNIX only. This variable is set on registry on Windows.
|
147
|
-
|
148
|
-
* library serach path
|
149
|
-
|
150
|
-
Windows:
|
151
|
-
add %ORACLE_HOME%\bin to PATH.
|
152
|
-
|
153
|
-
AIX:
|
154
|
-
add $ORACLE_HOME/lib to LIBPATH.
|
155
|
-
|
156
|
-
HP-UX PA-RISC 32-bit ruby:
|
157
|
-
add $ORACLE_HOME/lib32 to SHLIB_PATH.
|
158
|
-
If $ORACLE_HOME/lib32 doesn't exist, add $ORACLE_HOME/lib instead.
|
159
|
-
|
160
|
-
SPARC/Solaris 32-bit ruby:
|
161
|
-
add $ORACLE_HOME/lib32 to LD_LIBRARY_PATH_32.
|
162
|
-
If $ORACLE_HOME/lib32 doesn't exist, add $ORACLE_HOME/lib instead.
|
163
|
-
|
164
|
-
SPARC/Solaris 64-bit ruby:
|
165
|
-
add $ORACLE_HOME/lib to LD_LIBRARY_PATH_64.
|
166
|
-
|
167
|
-
Mac OS X:
|
168
|
-
add $ORACLE_HOME/lib to DYLD_LIBRARY_PATH.
|
169
|
-
|
170
|
-
Other 32-bit ruby:
|
171
|
-
add $ORACLE_HOME/lib32 to LD_LIBRARY_PATH.
|
172
|
-
If $ORACLE_HOME/lib32 doesn't exist, add $ORACLE_HOME/lib instead.
|
173
|
-
|
174
|
-
Other 64-bit ruby:
|
175
|
-
add $ORACLE_HOME/lib to LD_LIBRARY_PATH.
|
176
|
-
|
177
|
-
To connect the local database:
|
178
|
-
|
179
|
-
* ORACLE_SID
|
180
|
-
|
181
|
-
2. enjoy.
|
182
|
-
|
183
|
-
sample one-liner:
|
184
|
-
ruby -r oci8 -e 'OCI8.new("scott", "tiger", nil).exec("select * from emp") do |r| puts r.join(","); end'
|
185
|
-
|
186
|
-
== Oracle Instant Client
|
187
|
-
|
188
|
-
1. set environmet variables.
|
189
|
-
|
190
|
-
The follwing environmet variables are required:
|
191
|
-
|
192
|
-
* NLS_LANG
|
193
|
-
|
194
|
-
* library serach path
|
195
|
-
|
196
|
-
Windows:
|
197
|
-
add %ORACLE_HOME%\bin to PATH.
|
198
|
-
|
199
|
-
AIX:
|
200
|
-
add $ORACLE_HOME/lib to LIBPATH.
|
201
|
-
|
202
|
-
HP-UX PA-RISC 32-bit ruby:
|
203
|
-
add $ORACLE_HOME/lib32 to SHLIB_PATH.
|
204
|
-
If $ORACLE_HOME/lib32 doesn't exist, add $ORACLE_HOME/lib instead.
|
205
|
-
|
206
|
-
SPARC/Solaris 32-bit ruby:
|
207
|
-
add $ORACLE_HOME/lib32 to LD_LIBRARY_PATH_32.
|
208
|
-
If $ORACLE_HOME/lib32 doesn't exist, add $ORACLE_HOME/lib instead.
|
209
|
-
|
210
|
-
SPARC/Solaris 64-bit ruby:
|
211
|
-
add $ORACLE_HOME/lib to LD_LIBRARY_PATH_64.
|
212
|
-
|
213
|
-
Mac OS X:
|
214
|
-
add $ORACLE_HOME/lib to DYLD_LIBRARY_PATH.
|
215
|
-
|
216
|
-
Other 32-bit ruby:
|
217
|
-
add $ORACLE_HOME/lib32 to LD_LIBRARY_PATH.
|
218
|
-
If $ORACLE_HOME/lib32 doesn't exist, add $ORACLE_HOME/lib instead.
|
219
|
-
|
220
|
-
Other 64-bit ruby:
|
221
|
-
add $ORACLE_HOME/lib to LD_LIBRARY_PATH.
|
222
|
-
|
223
|
-
ORACLE_HOME and TNS_ADMIN are optional:
|
224
|
-
see: http://www.oracle.com/technology/tech/oci/instantclient/ic-faq.html#A4428
|
225
|
-
|
226
|
-
2. enjoy.
|
227
|
-
|
228
|
-
sample one-liner:
|
229
|
-
ruby -r oci8 -e 'OCI8.new("scott", "tiger", "//HOSTNAME_OR_IP/SID").exec("select * from emp") do |r| puts r.join(","); end'
|
230
|
-
|
231
|
-
== Platform specific topics
|
232
|
-
|
233
|
-
=== HP-UX
|
234
|
-
|
235
|
-
1. I was reported that it doesn't work with 64-bit ruby. :-<
|
236
|
-
|
237
|
-
2. link the libraries which contain thread local storages to ruby itself.
|
238
|
-
|
239
|
-
ruby 1.8.1 or later:
|
240
|
-
gzip -dc ruby-1.8.2.tar.gz | tar xvf -
|
241
|
-
cd ruby-1.8.2
|
242
|
-
./configure --enable-pthread
|
243
|
-
vi Makefile # add "-lcl" to LIBS manually.
|
244
|
-
make
|
245
|
-
make install
|
246
|
-
|
247
|
-
ruby 1.8.0 or 1.6.x:
|
248
|
-
gzip -dc ruby-1.x.x.tar.gz | tar xvf -
|
249
|
-
cd ruby-1.x.x
|
250
|
-
./configure
|
251
|
-
vi Makefile # add "-lpthread -lcl" to LIBS manually.
|
252
|
-
make
|
253
|
-
make install
|
254
|
-
|
255
|
-
If you can't recompile ruby, LD_PRELOAD may solve the problem.
|
256
|
-
|
257
|
-
LD_PRELOAD=/usr/lib/libpthread.1:/usr/lib/libcl.2
|
258
|
-
export LD_PRELOAD
|
259
|
-
|
260
|
-
=== Intel Mac
|
261
|
-
|
262
|
-
Oracle intant client is still, when I write this, pcc.
|
263
|
-
|
264
|
-
1. check whether the ruby is ppc bianry.
|
265
|
-
|
266
|
-
file `which ruby`
|
267
|
-
|
268
|
-
If it is universal bianry, use ditto to extract ppc binary.
|
269
|
-
|
270
|
-
http://blog.sven-tissot.de/daylist_html?year=2006&month=4&day=12
|
271
|
-
|
272
|
-
If it is i386 binary, compie it as ppc.
|
273
|
-
|
274
|
-
2. fix compilation flags.
|
275
|
-
|
276
|
-
ruby -r rbconfig -e "p Config::CONFIG['CFLAGS']"
|
277
|
-
ruby -r rbconfig -e "p Config::CONFIG['DLDLAGS']"
|
278
|
-
|
279
|
-
If they have '-arch i386', delete it from:
|
280
|
-
/usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
|
281
|
-
or
|
282
|
-
/usr/lib/ruby/1.8/universal-darwin8.0/rbconfig.rb
|
283
|
-
|
284
|
-
If haven't '-arch ppc', add it.
|
285
|
-
|
286
|
-
3. config, make and install
|
287
|
-
|
288
|
-
ruby setup.rb config -- --with-instant-client=/opt/oracle/instantclient10_1
|
289
|
-
make
|
290
|
-
make install
|
291
|
-
|
292
|
-
4. rollback the changes in 2.
|
293
|
-
|
294
|
-
***************************
|
295
|
-
in progress.
|
296
|
-
|
297
|
-
|
298
|
-
= How to run unit tests
|
299
|
-
|
300
|
-
1. see "How to run"
|
301
|
-
|
302
|
-
2. create user and tables on Oracle.
|
303
|
-
|
304
|
-
- connect to Oracle as system:
|
305
|
-
|
306
|
-
$ sqlplus system/<password_of_system>
|
307
|
-
|
308
|
-
- create user ruby:
|
309
|
-
|
310
|
-
SQL> CREATE USER ruby IDENTIFIED BY oci8;
|
311
|
-
or
|
312
|
-
SQL> CREATE USER ruby IDENTIFIED BY oci8
|
313
|
-
2 DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
|
314
|
-
|
315
|
-
- grant the privilege to connect and execute.
|
316
|
-
|
317
|
-
SQL> GRANT connect, resource, create synonym TO ruby;
|
318
|
-
|
319
|
-
- If the Oracle version is 8i or later:
|
320
|
-
|
321
|
-
SQL> CREATE TABLE ruby.test_clob (filename VARCHAR2(40), content CLOB);
|
322
|
-
|
323
|
-
- connect to Oracle as sys
|
324
|
-
|
325
|
-
$ sqlplus 'sys/<password_of_sys> as sysdba'
|
326
|
-
|
327
|
-
- grant the privilege for the unittest of blocking-mode.
|
328
|
-
|
329
|
-
SQL> GRANT EXECUTE ON dbms_lock TO ruby;
|
330
|
-
|
331
|
-
3. set $dbname in test/config.rb.
|
332
|
-
|
333
|
-
for instant client, or full client which connect the remote server.
|
334
|
-
|
335
|
-
4. run.
|
336
|
-
|
337
|
-
$ make check
|
338
54
|
or
|
339
|
-
$ nmake check (If your compiler is MS Visual C++.)
|
340
|
-
|
341
|
-
|
342
|
-
= How to customize fetched datatypes.
|
343
|
-
|
344
|
-
== OCI8::BindType::Mapping
|
345
55
|
|
346
|
-
|
347
|
-
|
56
|
+
SQL> CREATE USER ruby IDENTIFIED BY oci8
|
57
|
+
2 DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
|
348
58
|
|
349
|
-
|
350
|
-
fetch a Timestamp value as a OraDate:
|
351
|
-
OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP] = OCI8::BindType::OraDate
|
352
|
-
fetch a Timestamp value as a String:
|
353
|
-
OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP] = OCI8::BindType::String
|
59
|
+
3. grant the privilege to connect and execute.
|
354
60
|
|
355
|
-
|
356
|
-
OCI8::BindType::String
|
357
|
-
OCI8::BindType::RAW
|
358
|
-
OCI8::BindType::OraDate
|
359
|
-
OCI8::BindType::Time
|
360
|
-
OCI8::BindType::Date
|
361
|
-
OCI8::BindType::DateTime (ruby 1.8.0 or upper)
|
362
|
-
OCI8::BindType::Float
|
363
|
-
OCI8::BindType::Fixnum
|
364
|
-
OCI8::BindType::Integer
|
365
|
-
OCI8::BindType::OraNumber
|
366
|
-
OCI8::BindType::Number
|
367
|
-
OCI8::BindType::OCIRowid
|
368
|
-
OCI8::BindType::BLOB
|
369
|
-
OCI8::BindType::CLOB
|
370
|
-
OCI8::BindType::Cursor
|
61
|
+
SQL> GRANT connect, resource TO ruby;
|
371
62
|
|
372
|
-
|
63
|
+
4. If the Oracle version is 8i or later:
|
373
64
|
|
374
|
-
|
375
|
-
depends on the precision and scale.
|
376
|
-
Fixnum or Integer for NUMBER(p, 0). (prec is positive).
|
377
|
-
Float for NUMBER(prec, scale). (prec is less then 15).
|
378
|
-
OraNumber for NUMBER(prec, scale). (prec equals or is greater then 15).
|
65
|
+
SQL> CREATE TABLE ruby.test_clob (filename VARCHAR2(40), content CLOB);
|
379
66
|
|
380
|
-
|
381
|
-
fetched as a Float by default. To customize this behavior, you can
|
382
|
-
use OCI8::BindType::Mapping[:number_unknown_prec] and
|
383
|
-
OCI8::BindType::Mapping[:number_no_prec_setting].
|
67
|
+
5. connect to Oracle as sys
|
384
68
|
|
385
|
-
|
386
|
-
OCI8::BindType::Mapping[:number_unknown_prec] changes both behaviors.
|
69
|
+
$ sqlplus 'sys/<password_of_sys> as sysdba'
|
387
70
|
|
388
|
-
|
389
|
-
OCI8::BindType::Mapping[:number_no_prec_setting] changes the former.
|
390
|
-
OCI8::BindType::Mapping[:number_unknown_prec] changes the latter.
|
71
|
+
6. grant the privilege for the unittest of blocking-mode.
|
391
72
|
|
392
|
-
|
73
|
+
SQL> GRANT EXECUTE ON dbms_lock TO ruby;
|
393
74
|
|
394
|
-
|
395
|
-
SELECT col1 AS col FROM tab1:
|
396
|
-
SELECT col2 * 1.0 AS cal2 FROM tab1;
|
397
|
-
# col : NUMBER whose precision and scale are not defined explicitly.
|
398
|
-
# cal : calculated NUMBER value.
|
75
|
+
7. change test/config.rb as you like
|
399
76
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
:number_unknown_prec changes the both behaviors.
|
77
|
+
Then you can run:
|
78
|
+
$ make check
|
79
|
+
or
|
80
|
+
$ nmake check (If your compiler is MS Visual C++.)
|
405
81
|
|
406
|
-
|
407
|
-
OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::Integer
|
408
|
-
==> col is fetched as a Float.
|
409
|
-
cal is fetched as an Integer.
|
410
|
-
:number_unknown_prec changes the latter only.
|
82
|
+
= TODO
|
411
83
|
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
:number_no_prec_setting changes the former only.
|
84
|
+
* more proper handling of OCI_SUCCESS_WITH_INFO.
|
85
|
+
* more proper handling of NUMBER without its scale values.
|
86
|
+
* support Timestamp.
|