ruby-oci8 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,50 @@
1
+ # @title Report Installation Issues
2
+
3
+ Look at {file:docs/platform-specific-issues.md},
4
+ [the issues page on github][github] and [the ruby-oci8 help forum on rubyforge][rubyforge]
5
+ to check whether your issue is fixed or not.
6
+
7
+ If it is a new one, post the following information to [github][] or [rubyforge][].
8
+
9
+ [github]: https://github.com/kubo/ruby-oci8/issues
10
+ [rubyforge]: http://rubyforge.org/forum/forum.php?forum_id=1078
11
+
12
+ * Messages printed out to the console
13
+
14
+ * `gem_make.out` if you install a gem
15
+
16
+ * Last 100 lines of 'ext/oci8/mkmf.log'
17
+
18
+ Get them as follows.
19
+
20
+ tail -100 ext/oci8/mkmf.log
21
+
22
+ * The results of the following commands:
23
+
24
+ file `which ruby`
25
+ ruby --version
26
+ ruby -r rbconfig -e "p Config::CONFIG['host']"
27
+ ruby -r rbconfig -e "p Config::CONFIG['CC']"
28
+ ruby -r rbconfig -e "p Config::CONFIG['CFLAGS']"
29
+ ruby -r rbconfig -e "p Config::CONFIG['LDSHARED']"
30
+ ruby -r rbconfig -e "p Config::CONFIG['LDFLAGS']"
31
+ ruby -r rbconfig -e "p Config::CONFIG['DLDLAGS']"
32
+ ruby -r rbconfig -e "p Config::CONFIG['LIBS']"
33
+ ruby -r rbconfig -e "p Config::CONFIG['GNU_LD']"
34
+
35
+ # if you use gcc,
36
+ gcc --print-prog-name=ld
37
+ gcc --print-prog-name=as
38
+
39
+ # Oracle full client
40
+ file $ORACLE_HOME/bin/oracle
41
+
42
+ # Oracle Instant client. You need to change INSTANT_CLIENT_DIRECTORY.
43
+ file INSTANT_CLIENT_DIRECTORY/libclntsh.*
44
+
45
+ echo $LD_LIBRARY_PATH
46
+ echo $LIBPATH # AIX
47
+ echo $SHLIB_PATH # HP-UX PA-RISC 32-bit ruby
48
+ echo $DYLD_LIBRARY_PATH # Mac OS X
49
+ echo $LD_LIBRARY_PATH_32 # Solaris 32-bit ruby
50
+ echo $LD_LIBRARY_PATH_64 # Solaris 64-bit ruby
data/ext/oci8/apiwrap.yml CHANGED
@@ -379,20 +379,6 @@ OCILogoff:
379
379
  - OCISvcCtx *svchp
380
380
  - OCIError *errhp
381
381
 
382
- # round trip: 1
383
- OCILogon_nb:
384
- :version: 800
385
- :args:
386
- - OCIEnv *envhp
387
- - OCIError *errhp
388
- - OCISvcCtx **svchp
389
- - CONST text *username
390
- - ub4 uname_len
391
- - CONST text *password
392
- - ub4 passwd_len
393
- - CONST text *dbname
394
- - ub4 dbname_len
395
-
396
382
  # round trip: 0
397
383
  OCINumberAbs:
398
384
  :version: 800
@@ -1301,6 +1287,21 @@ OCIIntervalSetYearMonth:
1301
1287
  - sb4 mnth
1302
1288
  - OCIInterval *result
1303
1289
 
1290
+ # round trip: 1
1291
+ OCILogon2_nb:
1292
+ :version: 900
1293
+ :args:
1294
+ - OCIEnv *envhp
1295
+ - OCIError *errhp
1296
+ - OCISvcCtx **svchp
1297
+ - CONST text *username
1298
+ - ub4 uname_len
1299
+ - CONST text *password
1300
+ - ub4 passwd_len
1301
+ - CONST text *dbname
1302
+ - ub4 dbname_len
1303
+ - ub4 mode
1304
+
1304
1305
  # round trip: 0 (not docmented. I guess.)
1305
1306
  OCIRowidToChar:
1306
1307
  :version: 900
@@ -1342,6 +1343,28 @@ OCINlsCharSetNameToId:
1342
1343
  - dvoid *envhp
1343
1344
  - const oratext *name
1344
1345
 
1346
+ OCIStmtPrepare2:
1347
+ :version: 920
1348
+ :args:
1349
+ - OCISvcCtx *svchp
1350
+ - OCIStmt **stmtp
1351
+ - OCIError *errhp
1352
+ - const OraText *stmt
1353
+ - ub4 stmt_len
1354
+ - const OraText *key
1355
+ - ub4 key_len
1356
+ - ub4 language
1357
+ - ub4 mode
1358
+
1359
+ OCIStmtRelease:
1360
+ :version: 920
1361
+ :args:
1362
+ - OCIStmt *stmtp
1363
+ - OCIError *errhp
1364
+ - const OraText *key
1365
+ - ub4 key_len
1366
+ - ub4 mode
1367
+
1345
1368
  #
1346
1369
  # Oracle 10.1
1347
1370
  #
data/ext/oci8/error.c CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  error.c - part of ruby-oci8
4
4
 
5
- Copyright (C) 2002-2011 KUBO Takehiro <kubo@jiubao.org>
5
+ Copyright (C) 2002-2012 KUBO Takehiro <kubo@jiubao.org>
6
6
 
7
7
  */
8
8
  #include "oci8.h"
@@ -162,9 +162,13 @@ static VALUE set_backtrace(VALUE exc, const char *file, int line)
162
162
 
163
163
  /*
164
164
  * call-seq:
165
- * OCI8.new(message, code = nil, sql = nil, parse_error_offset = nil)
165
+ * initialize(message, code = nil, sql = nil, parse_error_offset = nil)
166
166
  *
167
167
  * Creates a new OCIError object.
168
+ *
169
+ * @example
170
+ * OCIError.new("ORA-00001: unique constraint (%s.%s) violated", 1)
171
+ * # => #<OCIError: ORA-00001: unique constraint (%s.%s) violated>
168
172
  */
169
173
  static VALUE oci8_error_initialize(int argc, VALUE *argv, VALUE self)
170
174
  {
@@ -211,6 +215,10 @@ void Init_oci8_error(void)
211
215
  eOCISuccessWithInfo = rb_define_class("OCISuccessWithInfo", eOCIError);
212
216
 
213
217
  rb_define_method(eOCIError, "initialize", oci8_error_initialize, -1);
218
+
219
+ /*
220
+ * @attr_reader [Integer] code error code
221
+ */
214
222
  rb_define_attr(eOCIError, "code", 1, 0);
215
223
  rb_define_attr(eOCIError, "sql", 1, 0);
216
224
  rb_define_attr(eOCIError, "parse_error_offset", 1, 0);
@@ -296,14 +304,11 @@ void oci8_check_error_(sword status, oci8_base_t *base, OCIStmt *stmthp, const c
296
304
  * These exceptions are raised when Oracle Call Interface functions
297
305
  * return with an error status.
298
306
  *
299
- * - OCIBreak
300
- * - OCIContinue
301
- * - OCIError
302
- * - OCISuccessWithInfo
303
- * - OCINoData (It had been a subclass of OCIException, not OCIError, until ruby-oci8 2.0)
304
- * - OCIInvalidHandle
305
- * - OCINeedData
306
- * - OCIStillExecuting
307
+ * - {OCIBreak}
308
+ * - {OCIError}
309
+ * - {OCISuccessWithInfo}
310
+ * - {OCINoData} (It had been a subclass of OCIException, not OCIError, until ruby-oci8 2.0)
311
+ * - {OCIInvalidHandle}
307
312
  */
308
313
 
309
314
  /*
@@ -311,7 +316,7 @@ void oci8_check_error_(sword status, oci8_base_t *base, OCIStmt *stmthp, const c
311
316
  *
312
317
  * Subclass of OCIException
313
318
  *
314
- * Raised when a SQL execution is cancelled by OCI8#break.
319
+ * Raised when a SQL execution is cancelled by {OCI8#break}.
315
320
  */
316
321
 
317
322
  /*
@@ -335,6 +340,10 @@ void oci8_check_error_(sword status, oci8_base_t *base, OCIStmt *stmthp, const c
335
340
  *
336
341
  * Raised when underlying Oracle Call Interface failed with an Oracle error code
337
342
  * such as ORA-00001.
343
+ *
344
+ * @attr_reader [Integer] code error code
345
+ * @attr_reader [String] sql SQL statement
346
+ * @attr_reader [Integer] parse_error_offset position
338
347
  */
339
348
 
340
349
  /*
@@ -352,6 +361,8 @@ void oci8_check_error_(sword status, oci8_base_t *base, OCIStmt *stmthp, const c
352
361
  * Subclass of OCIException
353
362
  *
354
363
  * Report to the ruby-oci8 author if it is raised.
364
+ *
365
+ * @private
355
366
  */
356
367
 
357
368
  /*
@@ -360,6 +371,8 @@ void oci8_check_error_(sword status, oci8_base_t *base, OCIStmt *stmthp, const c
360
371
  * Subclass of OCIError
361
372
  *
362
373
  * Report to the ruby-oci8 author if it is raised.
374
+ *
375
+ * @private
363
376
  */
364
377
 
365
378
  /*
@@ -368,6 +381,8 @@ void oci8_check_error_(sword status, oci8_base_t *base, OCIStmt *stmthp, const c
368
381
  * Subclass of OCIException
369
382
  *
370
383
  * Report to the ruby-oci8 author if it is raised.
384
+ *
385
+ * @private
371
386
  */
372
387
 
373
388
  /*
data/ext/oci8/extconf.rb CHANGED
@@ -136,9 +136,8 @@ end
136
136
 
137
137
  # Config::CONFIG["ruby_version"] indicates the ruby API version.
138
138
  # 1.8 - ruby 1.8.x
139
- # 1.9.1 - ruby 1.9.1 and 1.9.2
140
- # 1.9.x - ruby 1.9.x future version which will break the API compatibility
141
- so_basename += Config::CONFIG["ruby_version"].gsub(/\W/, '')
139
+ # 1.9.1 - ruby 1.9.1, 1.9.2 and 2.0.0-dev at the present time.
140
+ so_basename += RbConfig::CONFIG["ruby_version"].gsub(/\W/, '')
142
141
 
143
142
  $defs << "-DInit_oci8lib=Init_#{so_basename}"
144
143
  $defs << "-Doci8lib=#{so_basename}"
@@ -174,6 +173,23 @@ end
174
173
 
175
174
  create_apiwrap()
176
175
 
176
+ case RUBY_PLATFORM
177
+ when /mingw32/
178
+ # Drop '-s' option from LDSHARED and explicitly run 'strip' to get the map file.
179
+ if RbConfig::MAKEFILE_CONFIG["LDSHARED"].gsub!(/-s\b/, '')
180
+ alias :oci8_configuration_orig :configuration
181
+ def configuration(*args)
182
+ oci8_configuration_orig(*args) << <<EOS
183
+
184
+ # Dirty hack to get the map file.
185
+ all__: all
186
+ nm $(DLLIB) | grep ' [TtBb] _[A-Za-z]' > $(TARGET).map
187
+ strip -s $(DLLIB)
188
+ EOS
189
+ end
190
+ end
191
+ end
192
+
177
193
  create_makefile(so_basename)
178
194
 
179
195
  exit 0
data/ext/oci8/lob.c CHANGED
@@ -163,6 +163,41 @@ static void bfile_close(oci8_lob_t *lob)
163
163
  }
164
164
  }
165
165
 
166
+ /*
167
+ * Document-class: OCI8::LOB
168
+ *
169
+ * This is the abstract base class of large-object data types; BFILE, BLOB, CLOB and NCLOB.
170
+ *
171
+ */
172
+
173
+ /*
174
+ * Document-class: OCI8::CLOB
175
+ *
176
+ */
177
+
178
+ /*
179
+ * Document-class: OCI8::NCLOB
180
+ *
181
+ */
182
+
183
+ /*
184
+ * Document-class: OCI8::BLOB
185
+ *
186
+ */
187
+
188
+ /*
189
+ * Document-class: OCI8::BFILE
190
+ *
191
+ * @method truncate(length)
192
+ * @method size = length
193
+ * @method write(data)
194
+ */
195
+
196
+ /*
197
+ * Closes the lob.
198
+ *
199
+ * @return [self]
200
+ */
166
201
  static VALUE oci8_lob_close(VALUE self)
167
202
  {
168
203
  oci8_lob_t *lob = DATA_PTR(self);
@@ -199,28 +234,87 @@ static VALUE oci8_lob_do_initialize(int argc, VALUE *argv, VALUE self, ub1 csfrm
199
234
  &svcctx->base);
200
235
  lob->svchp = oci8_get_oci_svcctx(svc);
201
236
  oci8_lob_write(self, val);
237
+ lob->pos = 0; /* reset the position */
202
238
  }
203
239
  return Qnil;
204
240
  }
205
241
 
242
+ /*
243
+ * call-seq:
244
+ * initialize(conn, contents = nil)
245
+ *
246
+ * Creates a temporary CLOB when <i>contents</i> is not nil.
247
+ * Otherwise, it creates an uninitialized lob, which is used internally
248
+ * to fetch CLOB column data.
249
+ *
250
+ * @example
251
+ * # Inserts a file name and its contents as CLOB.
252
+ * clob = OCI8::CLOB.new(conn, File.read(file_name))
253
+ * conn.exec('insert into file_contents values (:1, :2)', file_name, clob)
254
+ *
255
+ * @param [OCI8] conn connection
256
+ * @param [String] contents
257
+ * @return [OCI8::CLOB]
258
+ */
206
259
  static VALUE oci8_clob_initialize(int argc, VALUE *argv, VALUE self)
207
260
  {
208
261
  oci8_lob_do_initialize(argc, argv, self, SQLCS_IMPLICIT, OCI_TEMP_CLOB);
209
262
  return Qnil;
210
263
  }
211
264
 
265
+ /*
266
+ * call-seq:
267
+ * initialize(conn, contents = nil)
268
+ *
269
+ * Creates a temporary NCLOB when <i>contents</i> is not nil.
270
+ * Otherwise, it creates an uninitialized lob, which is used internally
271
+ * to fetch NCLOB column data.
272
+ *
273
+ * @example
274
+ * # Inserts a file name and its contents as NCLOB.
275
+ * clob = OCI8::NCLOB.new(conn, File.read(file_name))
276
+ * conn.exec('insert into file_contents values (:1, :2)', file_name, clob)
277
+ *
278
+ * @param [OCI8] conn
279
+ * @param [String] contents
280
+ * @return [OCI8::NCLOB]
281
+ */
212
282
  static VALUE oci8_nclob_initialize(int argc, VALUE *argv, VALUE self)
213
283
  {
214
284
  oci8_lob_do_initialize(argc, argv, self, SQLCS_NCHAR, OCI_TEMP_CLOB);
215
285
  return Qnil;
216
286
  }
217
287
 
288
+ /*
289
+ * call-seq:
290
+ * initialize(conn, contents = nil)
291
+ *
292
+ * Creates a temporary BLOB when <i>contents</i> is not nil.
293
+ * Otherwise, it creates an uninitialized lob, which is used internally
294
+ * to fetch BLOB column data.
295
+ *
296
+ * @example
297
+ * # Inserts a file name and its contents as BLOB.
298
+ * clob = OCI8::BLOB.new(conn, File.read(file_name, :mode => 'rb'))
299
+ * conn.exec('insert into file_contents values (:1, :2)', file_name, clob)
300
+ *
301
+ * @param [OCI8] conn
302
+ * @param [String] contents
303
+ * @return [OCI8::BLOB]
304
+ */
218
305
  static VALUE oci8_blob_initialize(int argc, VALUE *argv, VALUE self)
219
306
  {
220
307
  oci8_lob_do_initialize(argc, argv, self, SQLCS_IMPLICIT, OCI_TEMP_BLOB);
221
308
  return Qnil;
222
309
  }
223
310
 
311
+ /*
312
+ * call-seq:
313
+ * __char_width = size
314
+ *
315
+ * @private
316
+ * IMO, nobody need and use this.
317
+ */
224
318
  static VALUE oci8_lob_set_char_width(VALUE self, VALUE vsize)
225
319
  {
226
320
  oci8_lob_t *lob = DATA_PTR(self);
@@ -234,6 +328,11 @@ static VALUE oci8_lob_set_char_width(VALUE self, VALUE vsize)
234
328
  return vsize;
235
329
  }
236
330
 
331
+ /*
332
+ * Returns +true+ when <i>self</i> is initialized.
333
+ *
334
+ * @return [true or false]
335
+ */
237
336
  static VALUE oci8_lob_available_p(VALUE self)
238
337
  {
239
338
  oci8_lob_t *lob = DATA_PTR(self);
@@ -244,17 +343,36 @@ static VALUE oci8_lob_available_p(VALUE self)
244
343
  return is_initialized ? Qtrue : Qfalse;
245
344
  }
246
345
 
346
+ /*
347
+ * Returns the size.
348
+ * For CLOB and NCLOB it is the number of characters,
349
+ * for BLOB and BFILE it is the number of bytes.
350
+ *
351
+ * @return [Integer]
352
+ */
247
353
  static VALUE oci8_lob_get_size(VALUE self)
248
354
  {
249
355
  return UB4_TO_NUM(oci8_lob_get_length(DATA_PTR(self)));
250
356
  }
251
357
 
358
+ /*
359
+ * Returns the current offset.
360
+ * For CLOB and NCLOB it is the number of characters,
361
+ * for BLOB and BFILE it is the number of bytes.
362
+ *
363
+ * @return [Integer]
364
+ */
252
365
  static VALUE oci8_lob_get_pos(VALUE self)
253
366
  {
254
367
  oci8_lob_t *lob = DATA_PTR(self);
255
368
  return UB4_TO_NUM(lob->pos);
256
369
  }
257
370
 
371
+ /*
372
+ * Returns true if the current offset is at end of lob.
373
+ *
374
+ * @return [true or false]
375
+ */
258
376
  static VALUE oci8_lob_eof_p(VALUE self)
259
377
  {
260
378
  oci8_lob_t *lob = DATA_PTR(self);
@@ -264,6 +382,20 @@ static VALUE oci8_lob_eof_p(VALUE self)
264
382
  return Qtrue;
265
383
  }
266
384
 
385
+ /*
386
+ * call-seq:
387
+ * seek(amount, whence=IO::SEEK_SET)
388
+ *
389
+ * Seeks to the given offset in the stream. The new position, measured in characters,
390
+ * is obtained by adding offset <i>amount</i> to the position specified by <i>whence</i>.
391
+ * If <i>whence</i> is set to IO::SEEK_SET, IO::SEEK_CUR, or IO::SEEK_END,
392
+ * the offset is relative to the start of the file, the current position
393
+ * indicator, or end-of-file, respectively.
394
+ *
395
+ * @param [Integer] amount
396
+ * @param [IO::SEEK_SET, IO::SEEK_CUR or IO::SEEK_END] whence
397
+ * @return [self]
398
+ */
267
399
  static VALUE oci8_lob_seek(int argc, VALUE *argv, VALUE self)
268
400
  {
269
401
  oci8_lob_t *lob = DATA_PTR(self);
@@ -288,6 +420,11 @@ static VALUE oci8_lob_seek(int argc, VALUE *argv, VALUE self)
288
420
  return self;
289
421
  }
290
422
 
423
+ /*
424
+ * Sets the current offset at the beginning.
425
+ *
426
+ * @return [true or false]
427
+ */
291
428
  static VALUE oci8_lob_rewind(VALUE self)
292
429
  {
293
430
  oci8_lob_t *lob = DATA_PTR(self);
@@ -295,6 +432,15 @@ static VALUE oci8_lob_rewind(VALUE self)
295
432
  return self;
296
433
  }
297
434
 
435
+ /*
436
+ * call-seq:
437
+ * truncate(length)
438
+ *
439
+ * Changes the lob size to the given <i>length</i>.
440
+ *
441
+ * @param [Integer] length
442
+ * @return [self]
443
+ */
298
444
  static VALUE oci8_lob_truncate(VALUE self, VALUE len)
299
445
  {
300
446
  oci8_lob_t *lob = DATA_PTR(self);
@@ -306,12 +452,36 @@ static VALUE oci8_lob_truncate(VALUE self, VALUE len)
306
452
  return self;
307
453
  }
308
454
 
455
+ /*
456
+ * call-seq:
457
+ * size = length
458
+ *
459
+ * Changes the lob size to the given <i>length</i>.
460
+ *
461
+ * @param [Integer] length
462
+ * @return [Integer]
463
+ */
309
464
  static VALUE oci8_lob_set_size(VALUE self, VALUE len)
310
465
  {
311
466
  oci8_lob_truncate(self, len);
312
467
  return len;
313
468
  }
314
469
 
470
+ /*
471
+ * call-seq:
472
+ * read(length = nil)
473
+ *
474
+ * Reads <i>length</i> characters for CLOB and NCLOB or <i>length</i>
475
+ * bytes for BLOB and BILF from the current position.
476
+ * If <i>length</i> is <code>nil</code>, it reads data until EOF.
477
+ *
478
+ * It returns a string or <code>nil</code>. <code>nil</code> means it
479
+ * met EOF at beginning. As a special exception, when <i>length</i> is
480
+ * <code>nil</code> and the lob length is zero, it returns an empty string ''.
481
+ *
482
+ * @param [Integer] length
483
+ * @return [String or nil]
484
+ */
315
485
  static VALUE oci8_lob_read(int argc, VALUE *argv, VALUE self)
316
486
  {
317
487
  oci8_lob_t *lob = DATA_PTR(self);
@@ -327,6 +497,9 @@ static VALUE oci8_lob_read(int argc, VALUE *argv, VALUE self)
327
497
 
328
498
  rb_scan_args(argc, argv, "01", &size);
329
499
  length = oci8_lob_get_length(lob);
500
+ if (length == 0 && NIL_P(size)) {
501
+ return rb_usascii_str_new("", 0);
502
+ }
330
503
  if (length <= lob->pos) /* EOF */
331
504
  return Qnil;
332
505
  length -= lob->pos;
@@ -412,6 +585,15 @@ static VALUE oci8_lob_read(int argc, VALUE *argv, VALUE self)
412
585
  }
413
586
  }
414
587
 
588
+ /*
589
+ * call-seq:
590
+ * write(data)
591
+ *
592
+ * Writes <i>data</i>.
593
+ *
594
+ * @param [String] data
595
+ * @return [Integer]
596
+ */
415
597
  static VALUE oci8_lob_write(VALUE self, VALUE data)
416
598
  {
417
599
  oci8_lob_t *lob = DATA_PTR(self);
@@ -427,18 +609,30 @@ static VALUE oci8_lob_write(VALUE self, VALUE data)
427
609
  }
428
610
  RB_GC_GUARD(data);
429
611
  amt = RSTRING_LEN(data);
612
+ if (amt == 0) {
613
+ /* to avoid ORA-24801: illegal parameter value in OCI lob function */
614
+ return INT2FIX(0);
615
+ }
430
616
  chker2(OCILobWrite_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, &amt, lob->pos + 1, RSTRING_PTR(data), amt, OCI_ONE_PIECE, NULL, NULL, 0, lob->csfrm),
431
617
  &svcctx->base);
432
618
  lob->pos += amt;
433
619
  return UINT2NUM(amt);
434
620
  }
435
621
 
622
+ /*
623
+ * @deprecated I'm not sure that this is what the name indicates.
624
+ * @private
625
+ */
436
626
  static VALUE oci8_lob_get_sync(VALUE self)
437
627
  {
438
628
  oci8_lob_t *lob = DATA_PTR(self);
439
629
  return (lob->state == S_NO_OPEN_CLOSE) ? Qtrue : Qfalse;
440
630
  }
441
631
 
632
+ /*
633
+ * @deprecated I'm not sure that this is what the name indicates.
634
+ * @private
635
+ */
442
636
  static VALUE oci8_lob_set_sync(VALUE self, VALUE b)
443
637
  {
444
638
  oci8_lob_t *lob = DATA_PTR(self);
@@ -452,6 +646,10 @@ static VALUE oci8_lob_set_sync(VALUE self, VALUE b)
452
646
  return b;
453
647
  }
454
648
 
649
+ /*
650
+ * @deprecated I'm not sure that this is what the name indicates.
651
+ * @private
652
+ */
455
653
  static VALUE oci8_lob_flush(VALUE self)
456
654
  {
457
655
  oci8_lob_t *lob = DATA_PTR(self);
@@ -459,6 +657,12 @@ static VALUE oci8_lob_flush(VALUE self)
459
657
  return self;
460
658
  }
461
659
 
660
+ /*
661
+ * Returns the chunk size of a LOB.
662
+ *
663
+ * @see http://docs.oracle.com/cd/E16338_01/appdev.112/e10646/oci17msc002.htm#i493090
664
+ * @return [Integer]
665
+ */
462
666
  static VALUE oci8_lob_get_chunk_size(VALUE self)
463
667
  {
464
668
  oci8_lob_t *lob = DATA_PTR(self);
@@ -544,6 +748,19 @@ static void oci8_bfile_set_name(VALUE self, VALUE dir_alias, VALUE filename)
544
748
  &lob->base);
545
749
  }
546
750
 
751
+ /*
752
+ * call-seq:
753
+ * initialize(conn, dir_alias = nil, filename = nil)
754
+ *
755
+ * Creates a BFILE object.
756
+ * This is correspond to {http://docs.oracle.com/cd/E11882_01/server.112/e17118/functions019.htm#sthref953 BFILENAME}.
757
+ *
758
+ * @param [OCI8] conn
759
+ * @param [String] dir_alias a directory object created by
760
+ * {http://docs.oracle.com/cd/E11882_01/server.112/e17118/statements_5007.htm "CREATE DIRECTORY"}.
761
+ * @param [String] filename
762
+ * @return [OCI8::BFILE]
763
+ */
547
764
  static VALUE oci8_bfile_initialize(int argc, VALUE *argv, VALUE self)
548
765
  {
549
766
  oci8_lob_t *lob = DATA_PTR(self);
@@ -574,6 +791,11 @@ static VALUE oci8_bfile_initialize(int argc, VALUE *argv, VALUE self)
574
791
  return Qnil;
575
792
  }
576
793
 
794
+ /*
795
+ * Returns the directory object name.
796
+ *
797
+ * @return [String]
798
+ */
577
799
  static VALUE oci8_bfile_get_dir_alias(VALUE self)
578
800
  {
579
801
  VALUE dir_alias;
@@ -582,6 +804,11 @@ static VALUE oci8_bfile_get_dir_alias(VALUE self)
582
804
  return dir_alias;
583
805
  }
584
806
 
807
+ /*
808
+ * Returns the file name.
809
+ *
810
+ * @return [String]
811
+ */
585
812
  static VALUE oci8_bfile_get_filename(VALUE self)
586
813
  {
587
814
  VALUE filename;
@@ -590,6 +817,14 @@ static VALUE oci8_bfile_get_filename(VALUE self)
590
817
  return filename;
591
818
  }
592
819
 
820
+ /*
821
+ * call-seq:
822
+ * dir_alias = name
823
+ *
824
+ * Changes the directory object name.
825
+ *
826
+ * @param [String] name
827
+ */
593
828
  static VALUE oci8_bfile_set_dir_alias(VALUE self, VALUE dir_alias)
594
829
  {
595
830
  VALUE filename;
@@ -601,6 +836,14 @@ static VALUE oci8_bfile_set_dir_alias(VALUE self, VALUE dir_alias)
601
836
  return dir_alias;
602
837
  }
603
838
 
839
+ /*
840
+ * call-seq:
841
+ * filename = name
842
+ *
843
+ * Changes the file name.
844
+ *
845
+ * @param [String] name
846
+ */
604
847
  static VALUE oci8_bfile_set_filename(VALUE self, VALUE filename)
605
848
  {
606
849
  VALUE dir_alias;
@@ -612,6 +855,11 @@ static VALUE oci8_bfile_set_filename(VALUE self, VALUE filename)
612
855
  return filename;
613
856
  }
614
857
 
858
+ /*
859
+ * Returns <code>true</code> when the BFILE exists on the server's operating system.
860
+ *
861
+ * @return [true or false]
862
+ */
615
863
  static VALUE oci8_bfile_exists_p(VALUE self)
616
864
  {
617
865
  oci8_lob_t *lob = DATA_PTR(self);
@@ -623,6 +871,39 @@ static VALUE oci8_bfile_exists_p(VALUE self)
623
871
  return flag ? Qtrue : Qfalse;
624
872
  }
625
873
 
874
+ /*
875
+ * Document-method: OCI8::BFILE#truncate
876
+ *
877
+ * call-seq:
878
+ * truncate(length)
879
+ *
880
+ * Raises <code>RuntimeError</code>.
881
+ *
882
+ * @raise [RuntimeError] cannot modify a read-only BFILE object
883
+ */
884
+
885
+ /*
886
+ * Document-method: OCI8::BFILE#size=
887
+ *
888
+ * call-seq:
889
+ * size = length
890
+ *
891
+ * Raises <code>RuntimeError</code>.
892
+ *
893
+ * @raise [RuntimeError] cannot modify a read-only BFILE object
894
+ */
895
+
896
+ /*
897
+ * Document-method: OCI8::BFILE#write
898
+ *
899
+ * call-seq:
900
+ * write(data)
901
+ *
902
+ * Raises <code>RuntimeError</code>.
903
+ *
904
+ * @raise [RuntimeError] cannot modify a read-only BFILE object
905
+ */
906
+
626
907
  static VALUE oci8_bfile_error(VALUE self, VALUE dummy)
627
908
  {
628
909
  rb_raise(rb_eRuntimeError, "cannot modify a read-only BFILE object");
@@ -761,6 +1042,12 @@ void Init_oci8_lob(VALUE cOCI8)
761
1042
  seek_cur = rb_eval_string("::IO::SEEK_CUR");
762
1043
  seek_end = rb_eval_string("::IO::SEEK_END");
763
1044
 
1045
+ #if 0
1046
+ cOCIHandle = rb_define_class("OCIHandle", rb_cObject);
1047
+ cOCI8 = rb_define_class("OCI8", cOCIHandle);
1048
+ cOCI8LOB = rb_define_class_under(cOCI8, "LOB", cOCIHandle);
1049
+ #endif
1050
+
764
1051
  cOCI8LOB = oci8_define_class_under(cOCI8, "LOB", &oci8_lob_vtable);
765
1052
  cOCI8CLOB = rb_define_class_under(cOCI8, "CLOB", cOCI8LOB);
766
1053
  cOCI8NCLOB = rb_define_class_under(cOCI8, "NCLOB", cOCI8LOB);