ruby-oci8 1.0.6-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/ChangeLog +693 -0
  2. data/Makefile +51 -0
  3. data/NEWS +407 -0
  4. data/README +415 -0
  5. data/VERSION +1 -0
  6. data/dist-files +71 -0
  7. data/doc/api.en.html +527 -0
  8. data/doc/api.en.rd +554 -0
  9. data/doc/api.ja.html +525 -0
  10. data/doc/api.ja.rd +557 -0
  11. data/doc/manual.css +35 -0
  12. data/ext/oci8/oci8lib.so +0 -0
  13. data/lib/dbd/OCI8.rb +591 -0
  14. data/lib/oci8.rb +1655 -0
  15. data/lib/oci8.rb.in +1655 -0
  16. data/metaconfig +142 -0
  17. data/pre-distclean.rb +7 -0
  18. data/ruby-oci8.gemspec +54 -0
  19. data/ruby-oci8.spec +62 -0
  20. data/setup.rb +1331 -0
  21. data/support/README +4 -0
  22. data/support/runit/assert.rb +281 -0
  23. data/support/runit/cui/testrunner.rb +101 -0
  24. data/support/runit/error.rb +4 -0
  25. data/support/runit/method_mappable.rb +20 -0
  26. data/support/runit/robserver.rb +25 -0
  27. data/support/runit/setuppable.rb +15 -0
  28. data/support/runit/teardownable.rb +16 -0
  29. data/support/runit/testcase.rb +113 -0
  30. data/support/runit/testfailure.rb +25 -0
  31. data/support/runit/testresult.rb +121 -0
  32. data/support/runit/testsuite.rb +43 -0
  33. data/support/runit/version.rb +3 -0
  34. data/test/README +4 -0
  35. data/test/config.rb +129 -0
  36. data/test/test_all.rb +48 -0
  37. data/test/test_bind_raw.rb +53 -0
  38. data/test/test_bind_time.rb +191 -0
  39. data/test/test_break.rb +81 -0
  40. data/test/test_clob.rb +101 -0
  41. data/test/test_connstr.rb +80 -0
  42. data/test/test_dbi.rb +327 -0
  43. data/test/test_dbi_clob.rb +58 -0
  44. data/test/test_describe.rb +137 -0
  45. data/test/test_metadata.rb +243 -0
  46. data/test/test_oci8.rb +273 -0
  47. data/test/test_oradate.rb +263 -0
  48. data/test/test_oranumber.rb +149 -0
  49. data/test/test_rowid.rb +38 -0
  50. metadata +105 -0
data/README ADDED
@@ -0,0 +1,415 @@
1
+ = How to make
2
+
3
+ == Oracle Full Client (not Oracle Instant Client)
4
+
5
+ 1. check the followings:
6
+ - ruby and make (or nmake on MSVC) are in the environment variable PATH.
7
+ - sqlplus runs correctly.
8
+
9
+ 2. check library search path.
10
+
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.)
15
+
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
21
+
22
+ == Oracle Instant Client
23
+
24
+ 1. donwload "Instant Client Package - Basic" and "Instant Client Package - SDK".
25
+
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
30
+
31
+ note:
32
+ download 32-bit packages for 32-bit ruby even though your OS is 64-bit.
33
+
34
+ 2. install Oracle Instant Client Packages.
35
+
36
+ zip packages:
37
+
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
43
+
44
+ rpm packages:
45
+
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
48
+
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
+ 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
+
346
+ OCI8::BindType::Mapping is available to change the mapping of Oracle
347
+ datatypes and ruby datatypes.
348
+
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
354
+
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
371
+
372
+ == Number datatype.
373
+
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).
379
+
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].
384
+
385
+ Oracle 9.2.0.2 or earlier:
386
+ OCI8::BindType::Mapping[:number_unknown_prec] changes both behaviors.
387
+
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.
391
+
392
+ Examples:
393
+
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.
399
+
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.
405
+
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.
411
+
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.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.6
@@ -0,0 +1,71 @@
1
+ NEWS
2
+ ChangeLog
3
+ Makefile
4
+ README
5
+ VERSION
6
+ dist-files
7
+ metaconfig
8
+ pre-distclean.rb
9
+ ruby-oci8.spec
10
+ ruby-oci8.gemspec
11
+ setup.rb
12
+ doc/api.en.html
13
+ doc/api.en.rd
14
+ doc/api.ja.html
15
+ doc/api.ja.rd
16
+ doc/manual.css
17
+ ext/oci8/MANIFEST
18
+ ext/oci8/attr.c
19
+ ext/oci8/bind.c
20
+ ext/oci8/const.c
21
+ ext/oci8/define.c
22
+ ext/oci8/describe.c
23
+ ext/oci8/descriptor.c
24
+ ext/oci8/env.c
25
+ ext/oci8/error.c
26
+ ext/oci8/extconf.rb
27
+ ext/oci8/handle.c
28
+ ext/oci8/lob.c
29
+ ext/oci8/oci8.c
30
+ ext/oci8/oci8.h
31
+ ext/oci8/ocinumber.c
32
+ ext/oci8/oraconf.rb
33
+ ext/oci8/oradate.c
34
+ ext/oci8/oranumber.c
35
+ ext/oci8/param.c
36
+ ext/oci8/post-config.rb
37
+ ext/oci8/server.c
38
+ ext/oci8/session.c
39
+ ext/oci8/stmt.c
40
+ ext/oci8/svcctx.c
41
+ lib/oci8.rb.in
42
+ lib/dbd/OCI8.rb
43
+ support/README
44
+ support/runit/assert.rb
45
+ support/runit/cui/testrunner.rb
46
+ support/runit/error.rb
47
+ support/runit/method_mappable.rb
48
+ support/runit/robserver.rb
49
+ support/runit/setuppable.rb
50
+ support/runit/teardownable.rb
51
+ support/runit/testcase.rb
52
+ support/runit/testfailure.rb
53
+ support/runit/testresult.rb
54
+ support/runit/testsuite.rb
55
+ support/runit/version.rb
56
+ test/README
57
+ test/config.rb
58
+ test/test_all.rb
59
+ test/test_bind_raw.rb
60
+ test/test_bind_time.rb
61
+ test/test_break.rb
62
+ test/test_clob.rb
63
+ test/test_connstr.rb
64
+ test/test_dbi.rb
65
+ test/test_dbi_clob.rb
66
+ test/test_describe.rb
67
+ test/test_oci8.rb
68
+ test/test_oradate.rb
69
+ test/test_oranumber.rb
70
+ test/test_metadata.rb
71
+ test/test_rowid.rb