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.
Files changed (58) hide show
  1. data/ChangeLog +1289 -383
  2. data/Makefile +48 -12
  3. data/NEWS +5 -419
  4. data/README +56 -385
  5. data/VERSION +1 -1
  6. data/dist-files +27 -27
  7. data/lib/.document +2 -0
  8. data/lib/dbd/OCI8.rb +2 -17
  9. data/lib/oci8.rb +48 -1622
  10. data/lib/oci8.rb.in +48 -1622
  11. data/lib/oci8/.document +5 -0
  12. data/lib/oci8/compat.rb +108 -0
  13. data/lib/oci8/datetime.rb +491 -0
  14. data/lib/oci8/encoding-init.rb +40 -0
  15. data/lib/oci8/encoding.yml +537 -0
  16. data/lib/oci8/metadata.rb +2077 -0
  17. data/lib/oci8/object.rb +548 -0
  18. data/lib/oci8/oci8.rb +798 -0
  19. data/lib/oci8/oracle_version.rb +144 -0
  20. data/lib/oci8lib_18.so +0 -0
  21. data/lib/oci8lib_191.so +0 -0
  22. data/metaconfig +3 -3
  23. data/ruby-oci8.gemspec +24 -15
  24. data/setup.rb +4 -4
  25. data/test/config.rb +64 -84
  26. data/test/test_all.rb +14 -21
  27. data/test/test_array_dml.rb +333 -0
  28. data/test/test_bind_raw.rb +18 -25
  29. data/test/test_bind_time.rb +78 -91
  30. data/test/test_break.rb +37 -35
  31. data/test/test_clob.rb +33 -89
  32. data/test/test_connstr.rb +5 -4
  33. data/test/test_datetime.rb +469 -0
  34. data/test/test_dbi.rb +99 -60
  35. data/test/test_dbi_clob.rb +3 -8
  36. data/test/test_metadata.rb +65 -51
  37. data/test/test_oci8.rb +151 -55
  38. data/test/test_oracle_version.rb +70 -0
  39. data/test/test_oradate.rb +76 -83
  40. data/test/test_oranumber.rb +405 -71
  41. data/test/test_rowid.rb +6 -11
  42. metadata +21 -25
  43. data/ext/oci8/oci8lib.so +0 -0
  44. data/ruby-oci8.spec +0 -62
  45. data/support/README +0 -4
  46. data/support/runit/assert.rb +0 -281
  47. data/support/runit/cui/testrunner.rb +0 -101
  48. data/support/runit/error.rb +0 -4
  49. data/support/runit/method_mappable.rb +0 -20
  50. data/support/runit/robserver.rb +0 -25
  51. data/support/runit/setuppable.rb +0 -15
  52. data/support/runit/teardownable.rb +0 -16
  53. data/support/runit/testcase.rb +0 -113
  54. data/support/runit/testfailure.rb +0 -25
  55. data/support/runit/testresult.rb +0 -121
  56. data/support/runit/testsuite.rb +0 -43
  57. data/support/runit/version.rb +0 -3
  58. data/test/test_describe.rb +0 -137
data/README CHANGED
@@ -1,415 +1,86 @@
1
1
  = How to make
2
2
 
3
- == Oracle Full Client (not Oracle Instant Client)
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
- 1. check the followings:
6
- - ruby and make (or nmake on MSVC) are in the environment variable PATH.
7
- - sqlplus runs correctly.
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
- 2. check library search path.
10
+ make (or nmake on MSVC)
10
11
 
11
- If sqlplus runs correctly, the environments variables are okay in general.
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
- 3. make and install
17
- gzip -dc ruby-oci8-0.1.xx.tar.gz | tar xvf -
18
- cd ruby-oci8-0.1.xx
19
- make # or nmake on MSVC.
20
- make install
14
+ linux:
15
+ ruby setup.rb config -- --with-instant-client
16
+ make
21
17
 
22
- == Oracle Instant Client
18
+ others:
19
+ ruby setup.rb config -- --with-instant-client=/path/to/instantclient10_1
20
+ make (or nmake on MSVC)
23
21
 
24
- 1. donwload "Instant Client Package - Basic" and "Instant Client Package - SDK".
22
+ = On compilation failure
25
23
 
26
- OTN (Oracle Technology Network):
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
- note:
32
- download 32-bit packages for 32-bit ruby even though your OS is 64-bit.
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
- 2. install Oracle Instant Client Packages.
43
+ = How to run unit test
35
44
 
36
- zip packages:
45
+ before runing unit test,
46
+ 1. connect to Oracle as system:
37
47
 
38
- mkdir /opt
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
- rpm packages:
50
+ 2. create user ruby:
45
51
 
46
- rpm -i path/to/oracle-instantclient-basic-10.1.0.X-X.XXX.rpm
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
- OCI8::BindType::Mapping is available to change the mapping of Oracle
347
- datatypes and ruby datatypes.
56
+ SQL> CREATE USER ruby IDENTIFIED BY oci8
57
+ 2 DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
348
58
 
349
- Examples:
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
- Bind-types are:
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
- == Number datatype.
63
+ 4. If the Oracle version is 8i or later:
373
64
 
374
- OCI8::BindType::Number is a special bindtype. The actual bindtype
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
- If fetched value is defiend as NUMBER or calculated value, it is
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
- Oracle 9.2.0.2 or earlier:
386
- OCI8::BindType::Mapping[:number_unknown_prec] changes both behaviors.
69
+ $ sqlplus 'sys/<password_of_sys> as sysdba'
387
70
 
388
- Oracle 9.2.0.3 or later:
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
- Examples:
73
+ SQL> GRANT EXECUTE ON dbms_lock TO ruby;
393
74
 
394
- CREATE TABLE tab1 (col1 NUMBER, col2 NUMBER(10));
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
- Oracle 9.2.0.2 or earlier:
401
- OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::Integer
402
- ==> col is fetched as an Integer.
403
- cal is fetched as an Integer.
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
- Oracle 9.2.0.3 or later:
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
- OCI8::BindType::Mapping[:number_no_prec_setting] = OCI8::BindType::Integer
413
- ==> col is fetched as an Integer.
414
- cal is fetched as a Float.
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.