ruby-oci8 2.2.3 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ChangeLog +427 -0
- data/NEWS +335 -42
- data/README.md +20 -9
- data/dist-files +9 -3
- data/docs/bind-array-to-in_cond.md +2 -2
- data/docs/conflicts-local-connections-and-processes.md +7 -4
- data/docs/hanging-after-inactivity.md +63 -0
- data/docs/install-binary-package.md +15 -11
- data/docs/install-full-client.md +18 -21
- data/docs/install-instant-client.md +45 -27
- data/docs/install-on-osx.md +31 -120
- data/docs/ldap-auth-and-function-interposition.md +123 -0
- data/docs/number-type-mapping.md +79 -0
- data/docs/platform-specific-issues.md +17 -50
- data/docs/report-installation-issue.md +3 -0
- data/docs/timeout-parameters.md +3 -0
- data/ext/oci8/apiwrap.c.tmpl +2 -5
- data/ext/oci8/apiwrap.rb +6 -1
- data/ext/oci8/apiwrap.yml +34 -22
- data/ext/oci8/attr.c +4 -2
- data/ext/oci8/bind.c +366 -6
- data/ext/oci8/connection_pool.c +3 -3
- data/ext/oci8/encoding.c +5 -5
- data/ext/oci8/env.c +8 -2
- data/ext/oci8/error.c +24 -16
- data/ext/oci8/extconf.rb +8 -4
- data/ext/oci8/hook_funcs.c +274 -61
- data/ext/oci8/lob.c +31 -75
- data/ext/oci8/metadata.c +2 -2
- data/ext/oci8/object.c +72 -27
- data/ext/oci8/oci8.c +45 -132
- data/ext/oci8/oci8.h +32 -88
- data/ext/oci8/oci8lib.c +178 -38
- data/ext/oci8/ocihandle.c +37 -37
- data/ext/oci8/ocinumber.c +23 -18
- data/ext/oci8/oraconf.rb +158 -339
- data/ext/oci8/oradate.c +19 -19
- data/ext/oci8/plthook.h +10 -0
- data/ext/oci8/plthook_elf.c +433 -268
- data/ext/oci8/plthook_osx.c +40 -9
- data/ext/oci8/plthook_win32.c +9 -0
- data/ext/oci8/stmt.c +52 -17
- data/ext/oci8/win32.c +4 -22
- data/lib/oci8/bindtype.rb +1 -15
- data/lib/oci8/check_load_error.rb +57 -10
- data/lib/oci8/cursor.rb +57 -25
- data/lib/oci8/metadata.rb +9 -1
- data/lib/oci8/object.rb +10 -0
- data/lib/oci8/oci8.rb +33 -28
- data/lib/oci8/oracle_version.rb +11 -1
- data/lib/oci8/properties.rb +22 -0
- data/lib/oci8/version.rb +1 -1
- data/lib/oci8.rb +48 -4
- data/lib/ruby-oci8.rb +0 -3
- data/pre-distclean.rb +1 -3
- data/ruby-oci8.gemspec +3 -8
- data/setup.rb +11 -2
- data/test/README.md +37 -0
- data/test/config.rb +1 -1
- data/test/setup_test_object.sql +21 -13
- data/test/setup_test_package.sql +59 -0
- data/test/test_all.rb +2 -0
- data/test/test_bind_boolean.rb +99 -0
- data/test/test_bind_integer.rb +47 -0
- data/test/test_break.rb +11 -9
- data/test/test_clob.rb +4 -16
- data/test/test_connstr.rb +29 -13
- data/test/test_datetime.rb +8 -3
- data/test/test_object.rb +27 -9
- data/test/test_oci8.rb +170 -46
- data/test/test_oranumber.rb +12 -6
- data/test/test_package_type.rb +15 -3
- data/test/test_properties.rb +17 -0
- metadata +40 -54
- data/docs/osx-install-dev-tools.png +0 -0
- data/test/README +0 -42
data/ext/oci8/ocihandle.c
CHANGED
@@ -217,7 +217,7 @@ static VALUE attr_get_common(int argc, VALUE *argv, VALUE self, enum datatype da
|
|
217
217
|
}
|
218
218
|
return rb_external_str_new_with_enc(v.charptr, size, oci8_encoding);
|
219
219
|
case DATATYPE_BINARY:
|
220
|
-
return
|
220
|
+
return rb_str_new(v.charptr, size);
|
221
221
|
case DATATYPE_INTEGER:
|
222
222
|
if (size > sizeof(onum.OCINumberPart) - 1) {
|
223
223
|
rb_raise(rb_eRuntimeError, "Too long size %u", size);
|
@@ -245,9 +245,9 @@ static VALUE attr_get_common(int argc, VALUE *argv, VALUE self, enum datatype da
|
|
245
245
|
*
|
246
246
|
* Gets the value of an attribute as `ub1' datatype.
|
247
247
|
*
|
248
|
-
* @param [
|
248
|
+
* @param [Integer] attr_type
|
249
249
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
250
|
-
* @return [
|
250
|
+
* @return [Integer]
|
251
251
|
*
|
252
252
|
* @since 2.0.4
|
253
253
|
* @private
|
@@ -262,9 +262,9 @@ static VALUE attr_get_ub1(int argc, VALUE *argv, VALUE self)
|
|
262
262
|
*
|
263
263
|
* Gets the value of an attribute as `ub2' datatype.
|
264
264
|
*
|
265
|
-
* @param [
|
265
|
+
* @param [Integer] attr_type
|
266
266
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
267
|
-
* @return [
|
267
|
+
* @return [Integer]
|
268
268
|
*
|
269
269
|
* @since 2.0.4
|
270
270
|
* @private
|
@@ -279,7 +279,7 @@ static VALUE attr_get_ub2(int argc, VALUE *argv, VALUE self)
|
|
279
279
|
*
|
280
280
|
* Gets the value of an attribute as `ub4' datatype.
|
281
281
|
*
|
282
|
-
* @param [
|
282
|
+
* @param [Integer] attr_type
|
283
283
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
284
284
|
* @return [Integer]
|
285
285
|
*
|
@@ -296,7 +296,7 @@ static VALUE attr_get_ub4(int argc, VALUE *argv, VALUE self)
|
|
296
296
|
*
|
297
297
|
* Gets the value of an attribute as `ub8' datatype.
|
298
298
|
*
|
299
|
-
* @param [
|
299
|
+
* @param [Integer] attr_type
|
300
300
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
301
301
|
* @return [Integer]
|
302
302
|
*
|
@@ -313,9 +313,9 @@ static VALUE attr_get_ub8(int argc, VALUE *argv, VALUE self)
|
|
313
313
|
*
|
314
314
|
* Gets the value of an attribute as `sb1' datatype.
|
315
315
|
*
|
316
|
-
* @param [
|
316
|
+
* @param [Integer] attr_type
|
317
317
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
318
|
-
* @return [
|
318
|
+
* @return [Integer]
|
319
319
|
*
|
320
320
|
* @since 2.0.4
|
321
321
|
* @private
|
@@ -330,9 +330,9 @@ static VALUE attr_get_sb1(int argc, VALUE *argv, VALUE self)
|
|
330
330
|
*
|
331
331
|
* Gets the value of an attribute as `sb2' datatype.
|
332
332
|
*
|
333
|
-
* @param [
|
333
|
+
* @param [Integer] attr_type
|
334
334
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
335
|
-
* @return [
|
335
|
+
* @return [Integer]
|
336
336
|
*
|
337
337
|
* @since 2.0.4
|
338
338
|
* @private
|
@@ -347,7 +347,7 @@ static VALUE attr_get_sb2(int argc, VALUE *argv, VALUE self)
|
|
347
347
|
*
|
348
348
|
* Gets the value of an attribute as `sb4' datatype.
|
349
349
|
*
|
350
|
-
* @param [
|
350
|
+
* @param [Integer] attr_type
|
351
351
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
352
352
|
* @return [Integer]
|
353
353
|
*
|
@@ -364,7 +364,7 @@ static VALUE attr_get_sb4(int argc, VALUE *argv, VALUE self)
|
|
364
364
|
*
|
365
365
|
* Gets the value of an attribute as `sb8' datatype.
|
366
366
|
*
|
367
|
-
* @param [
|
367
|
+
* @param [Integer] attr_type
|
368
368
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
369
369
|
* @return [Integer]
|
370
370
|
*
|
@@ -381,7 +381,7 @@ static VALUE attr_get_sb8(int argc, VALUE *argv, VALUE self)
|
|
381
381
|
*
|
382
382
|
* Gets the value of an attribute as `boolean' datatype.
|
383
383
|
*
|
384
|
-
* @param [
|
384
|
+
* @param [Integer] attr_type
|
385
385
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
386
386
|
* @return [true of false]
|
387
387
|
*
|
@@ -403,7 +403,7 @@ static VALUE attr_get_boolean(int argc, VALUE *argv, VALUE self)
|
|
403
403
|
* @note If the specified attr_type's datatype is not a
|
404
404
|
* pointer type, it causes a segmentation fault.
|
405
405
|
*
|
406
|
-
* @param [
|
406
|
+
* @param [Integer] attr_type
|
407
407
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
408
408
|
* @return [String]
|
409
409
|
*
|
@@ -424,7 +424,7 @@ static VALUE attr_get_string(int argc, VALUE *argv, VALUE self)
|
|
424
424
|
* @note If the specified attr_type's datatype is not a
|
425
425
|
* pointer type, it causes a segmentation fault.
|
426
426
|
*
|
427
|
-
* @param [
|
427
|
+
* @param [Integer] attr_type
|
428
428
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
429
429
|
* @return [String]
|
430
430
|
*
|
@@ -445,9 +445,9 @@ static VALUE attr_get_binary(int argc, VALUE *argv, VALUE self)
|
|
445
445
|
* @note If the specified attr_type's datatype is not a
|
446
446
|
* pointer type, it causes a segmentation fault.
|
447
447
|
*
|
448
|
-
* @param [
|
448
|
+
* @param [Integer] attr_type
|
449
449
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
450
|
-
* @return [
|
450
|
+
* @return [Integer]
|
451
451
|
*
|
452
452
|
* @since 2.0.4
|
453
453
|
* @private
|
@@ -466,7 +466,7 @@ static VALUE attr_get_integer(int argc, VALUE *argv, VALUE self)
|
|
466
466
|
* @note If the specified attr_type's datatype is not a
|
467
467
|
* pointer type, it causes a segmentation fault.
|
468
468
|
*
|
469
|
-
* @param [
|
469
|
+
* @param [Integer] attr_type
|
470
470
|
* @param [Boolean] strict If false, "ORA-24328: illegal attribute value" is ignored.
|
471
471
|
* @return [OraDate]
|
472
472
|
*
|
@@ -486,8 +486,8 @@ static VALUE attr_get_oradate(int argc, VALUE *argv, VALUE self)
|
|
486
486
|
* @note If the specified attr_type's datatype is a
|
487
487
|
* pointer type, it causes a segmentation fault.
|
488
488
|
*
|
489
|
-
* @param [
|
490
|
-
* @param [
|
489
|
+
* @param [Integer] attr_type
|
490
|
+
* @param [Integer] attr_value
|
491
491
|
* @return [self]
|
492
492
|
*
|
493
493
|
* @since 2.0.4
|
@@ -514,8 +514,8 @@ static VALUE attr_set_ub1(VALUE self, VALUE attr_type, VALUE val)
|
|
514
514
|
* @note If the specified attr_type's datatype is a
|
515
515
|
* pointer type, it causes a segmentation fault.
|
516
516
|
*
|
517
|
-
* @param [
|
518
|
-
* @param [
|
517
|
+
* @param [Integer] attr_type
|
518
|
+
* @param [Integer] attr_value
|
519
519
|
* @return [self]
|
520
520
|
*
|
521
521
|
* @since 2.0.4
|
@@ -542,7 +542,7 @@ static VALUE attr_set_ub2(VALUE self, VALUE attr_type, VALUE val)
|
|
542
542
|
* @note If the specified attr_type's datatype is a
|
543
543
|
* pointer type, it causes a segmentation fault.
|
544
544
|
*
|
545
|
-
* @param [
|
545
|
+
* @param [Integer] attr_type
|
546
546
|
* @param [Integer] attr_value
|
547
547
|
* @return [self]
|
548
548
|
*
|
@@ -570,7 +570,7 @@ static VALUE attr_set_ub4(VALUE self, VALUE attr_type, VALUE val)
|
|
570
570
|
* @note If the specified attr_type's datatype is a
|
571
571
|
* pointer type, it causes a segmentation fault.
|
572
572
|
*
|
573
|
-
* @param [
|
573
|
+
* @param [Integer] attr_type
|
574
574
|
* @param [Integer] attr_value
|
575
575
|
* @return [self]
|
576
576
|
*
|
@@ -598,8 +598,8 @@ static VALUE attr_set_ub8(VALUE self, VALUE attr_type, VALUE val)
|
|
598
598
|
* @note If the specified attr_type's datatype is a
|
599
599
|
* pointer type, it causes a segmentation fault.
|
600
600
|
*
|
601
|
-
* @param [
|
602
|
-
* @param [
|
601
|
+
* @param [Integer] attr_type
|
602
|
+
* @param [Integer] attr_value
|
603
603
|
* @return [self]
|
604
604
|
*
|
605
605
|
* @since 2.0.4
|
@@ -626,8 +626,8 @@ static VALUE attr_set_sb1(VALUE self, VALUE attr_type, VALUE val)
|
|
626
626
|
* @note If the specified attr_type's datatype is a
|
627
627
|
* pointer type, it causes a segmentation fault.
|
628
628
|
*
|
629
|
-
* @param [
|
630
|
-
* @param [
|
629
|
+
* @param [Integer] attr_type
|
630
|
+
* @param [Integer] attr_value
|
631
631
|
* @return [self]
|
632
632
|
*
|
633
633
|
* @since 2.0.4
|
@@ -654,7 +654,7 @@ static VALUE attr_set_sb2(VALUE self, VALUE attr_type, VALUE val)
|
|
654
654
|
* @note If the specified attr_type's datatype is a
|
655
655
|
* pointer type, it causes a segmentation fault.
|
656
656
|
*
|
657
|
-
* @param [
|
657
|
+
* @param [Integer] attr_type
|
658
658
|
* @param [Integer] attr_value
|
659
659
|
* @return [self]
|
660
660
|
*
|
@@ -682,7 +682,7 @@ static VALUE attr_set_sb4(VALUE self, VALUE attr_type, VALUE val)
|
|
682
682
|
* @note If the specified attr_type's datatype is a
|
683
683
|
* pointer type, it causes a segmentation fault.
|
684
684
|
*
|
685
|
-
* @param [
|
685
|
+
* @param [Integer] attr_type
|
686
686
|
* @param [Integer] attr_value
|
687
687
|
* @return [self]
|
688
688
|
*
|
@@ -710,7 +710,7 @@ static VALUE attr_set_sb8(VALUE self, VALUE attr_type, VALUE val)
|
|
710
710
|
* @note If the specified attr_type's datatype is a
|
711
711
|
* pointer type, it causes a segmentation fault.
|
712
712
|
*
|
713
|
-
* @param [
|
713
|
+
* @param [Integer] attr_type
|
714
714
|
* @param [true or false] attr_value
|
715
715
|
* @return [self]
|
716
716
|
*
|
@@ -737,7 +737,7 @@ static VALUE attr_set_boolean(VALUE self, VALUE attr_type, VALUE val)
|
|
737
737
|
* +attr_value+ is converted to {OCI8.encoding} before it is set
|
738
738
|
* when the ruby version is 1.9.
|
739
739
|
*
|
740
|
-
* @param [
|
740
|
+
* @param [Integer] attr_type
|
741
741
|
* @param [String] attr_value
|
742
742
|
* @return [self]
|
743
743
|
*
|
@@ -752,7 +752,7 @@ static VALUE attr_set_string(VALUE self, VALUE attr_type, VALUE val)
|
|
752
752
|
Check_Type(attr_type, T_FIXNUM);
|
753
753
|
OCI8SafeStringValue(val);
|
754
754
|
/* set attribute */
|
755
|
-
chker2(OCIAttrSet(base->hp.ptr, base->type, RSTRING_PTR(val),
|
755
|
+
chker2(OCIAttrSet(base->hp.ptr, base->type, RSTRING_PTR(val), RSTRING_LENINT(val), FIX2INT(attr_type), oci8_errhp), base);
|
756
756
|
return self;
|
757
757
|
}
|
758
758
|
|
@@ -761,7 +761,7 @@ static VALUE attr_set_string(VALUE self, VALUE attr_type, VALUE val)
|
|
761
761
|
*
|
762
762
|
* Sets the value of an attribute as `ub1 *' datatype.
|
763
763
|
*
|
764
|
-
* @param [
|
764
|
+
* @param [Integer] attr_type
|
765
765
|
* @param [String] attr_value
|
766
766
|
* @return [self]
|
767
767
|
*
|
@@ -776,7 +776,7 @@ static VALUE attr_set_binary(VALUE self, VALUE attr_type, VALUE val)
|
|
776
776
|
Check_Type(attr_type, T_FIXNUM);
|
777
777
|
SafeStringValue(val);
|
778
778
|
/* set attribute */
|
779
|
-
chker2(OCIAttrSet(base->hp.ptr, base->type, RSTRING_PTR(val),
|
779
|
+
chker2(OCIAttrSet(base->hp.ptr, base->type, RSTRING_PTR(val), RSTRING_LENINT(val), FIX2INT(attr_type), oci8_errhp), base);
|
780
780
|
return self;
|
781
781
|
}
|
782
782
|
|
@@ -787,7 +787,7 @@ static VALUE attr_set_binary(VALUE self, VALUE attr_type, VALUE val)
|
|
787
787
|
* +number+ is converted to internal Oracle NUMBER format before
|
788
788
|
* it is set.
|
789
789
|
*
|
790
|
-
* @param [
|
790
|
+
* @param [Integer] attr_type
|
791
791
|
* @param [Numeric] number
|
792
792
|
* @return [self]
|
793
793
|
*
|
data/ext/oci8/ocinumber.c
CHANGED
@@ -154,7 +154,7 @@ static void set_oci_number_from_str(OCINumber *result, VALUE str, VALUE fmt, VAL
|
|
154
154
|
StringValue(str);
|
155
155
|
/* set from string. */
|
156
156
|
if (NIL_P(fmt)) {
|
157
|
-
int rv = oranumber_from_str(result, RSTRING_PTR(str),
|
157
|
+
int rv = oranumber_from_str(result, RSTRING_PTR(str), RSTRING_LENINT(str));
|
158
158
|
if (rv == ORANUMBER_SUCCESS) {
|
159
159
|
return; /* success */
|
160
160
|
} else {
|
@@ -172,17 +172,17 @@ static void set_oci_number_from_str(OCINumber *result, VALUE str, VALUE fmt, VAL
|
|
172
172
|
}
|
173
173
|
StringValue(fmt);
|
174
174
|
fmt_ptr = RSTRING_ORATEXT(fmt);
|
175
|
-
fmt_len =
|
175
|
+
fmt_len = RSTRING_LENINT(fmt);
|
176
176
|
if (NIL_P(nls_params)) {
|
177
177
|
nls_params_ptr = NULL;
|
178
178
|
nls_params_len = 0;
|
179
179
|
} else {
|
180
180
|
StringValue(nls_params);
|
181
181
|
nls_params_ptr = RSTRING_ORATEXT(nls_params);
|
182
|
-
nls_params_len =
|
182
|
+
nls_params_len = RSTRING_LENINT(nls_params);
|
183
183
|
}
|
184
184
|
chkerr(OCINumberFromText(errhp,
|
185
|
-
RSTRING_ORATEXT(str),
|
185
|
+
RSTRING_ORATEXT(str), RSTRING_LENINT(str),
|
186
186
|
fmt_ptr, fmt_len, nls_params_ptr, nls_params_len,
|
187
187
|
result));
|
188
188
|
}
|
@@ -216,6 +216,8 @@ static int set_oci_number_from_num(OCINumber *result, VALUE num, int force, OCIE
|
|
216
216
|
num = rb_big2str(num, 10);
|
217
217
|
set_oci_number_from_str(result, num, Qnil, Qnil, errhp);
|
218
218
|
return 1;
|
219
|
+
default:
|
220
|
+
break;
|
219
221
|
}
|
220
222
|
if (RTEST(rb_obj_is_instance_of(num, cOCINumber))) {
|
221
223
|
/* OCI::Number */
|
@@ -247,7 +249,7 @@ static int set_oci_number_from_num(OCINumber *result, VALUE num, int force, OCIE
|
|
247
249
|
if (TYPE(ary[1]) != T_STRING) {
|
248
250
|
goto is_not_big_decimal;
|
249
251
|
}
|
250
|
-
digits_len =
|
252
|
+
digits_len = RSTRING_LENINT(ary[1]);
|
251
253
|
set_oci_number_from_str(&digits, ary[1], Qnil, Qnil, errhp);
|
252
254
|
/* check base */
|
253
255
|
if (TYPE(ary[2]) != T_FIXNUM || FIX2LONG(ary[2]) != 10) {
|
@@ -363,7 +365,7 @@ OCINumber *oci8_dbl_to_onum(OCINumber *result, double dbl, OCIError *errhp)
|
|
363
365
|
sword rv;
|
364
366
|
|
365
367
|
str = rb_obj_as_string(rb_float_new(dbl));
|
366
|
-
rv = oranumber_from_str(result, RSTRING_PTR(str),
|
368
|
+
rv = oranumber_from_str(result, RSTRING_PTR(str), RSTRING_LENINT(str));
|
367
369
|
if (rv != 0) {
|
368
370
|
oci8_raise_by_msgno(rv, NULL);
|
369
371
|
}
|
@@ -1307,14 +1309,14 @@ static VALUE onum_to_char(int argc, VALUE *argv, VALUE self)
|
|
1307
1309
|
}
|
1308
1310
|
StringValue(fmt);
|
1309
1311
|
fmt_ptr = RSTRING_ORATEXT(fmt);
|
1310
|
-
fmt_len =
|
1312
|
+
fmt_len = RSTRING_LENINT(fmt);
|
1311
1313
|
if (NIL_P(nls_params)) {
|
1312
1314
|
nls_params_ptr = NULL;
|
1313
1315
|
nls_params_len = 0;
|
1314
1316
|
} else {
|
1315
1317
|
StringValue(nls_params);
|
1316
1318
|
nls_params_ptr = RSTRING_ORATEXT(nls_params);
|
1317
|
-
nls_params_len =
|
1319
|
+
nls_params_len = RSTRING_LENINT(nls_params);
|
1318
1320
|
}
|
1319
1321
|
rv = OCINumberToText(errhp, _NUMBER(self),
|
1320
1322
|
fmt_ptr, fmt_len, nls_params_ptr, nls_params_len,
|
@@ -1435,23 +1437,23 @@ static VALUE onum_to_d_real(OCINumber *num, OCIError *errhp)
|
|
1435
1437
|
rb_require("bigdecimal");
|
1436
1438
|
cBigDecimal = rb_const_get(rb_cObject, id_BigDecimal);
|
1437
1439
|
}
|
1438
|
-
chkerr(OCINumberToText(errhp, num, (const oratext *)fmt, strlen(fmt),
|
1440
|
+
chkerr(OCINumberToText(errhp, num, (const oratext *)fmt, (ub4)strlen(fmt),
|
1439
1441
|
NULL, 0, &buf_size, TO_ORATEXT(buf)));
|
1440
1442
|
return rb_funcall(rb_cObject, id_BigDecimal, 1, rb_usascii_str_new(buf, buf_size));
|
1441
1443
|
}
|
1442
1444
|
|
1443
1445
|
/*
|
1444
|
-
* @overload
|
1446
|
+
* @overload has_fractional_part?
|
1445
1447
|
*
|
1446
|
-
* Returns <code>true</code> if <i>self</i> has a
|
1448
|
+
* Returns <code>true</code> if <i>self</i> has a fractional part.
|
1447
1449
|
*
|
1448
1450
|
* @example
|
1449
|
-
* OraNumber(10).
|
1450
|
-
* OraNumber(10.1).
|
1451
|
+
* OraNumber(10).has_fractional_part? # => false
|
1452
|
+
* OraNumber(10.1).has_fractional_part? # => true
|
1451
1453
|
*
|
1452
|
-
* @since 2.
|
1454
|
+
* @since 2.2.5
|
1453
1455
|
*/
|
1454
|
-
static VALUE
|
1456
|
+
static VALUE onum_has_fractional_part_p(VALUE self)
|
1455
1457
|
{
|
1456
1458
|
OCIError *errhp = oci8_errhp;
|
1457
1459
|
boolean result;
|
@@ -1793,6 +1795,7 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1793
1795
|
id_BigDecimal = rb_intern("BigDecimal");
|
1794
1796
|
|
1795
1797
|
cOCINumber = rb_define_class("OraNumber", rb_cNumeric);
|
1798
|
+
rb_define_alloc_func(cOCINumber, onum_s_alloc);
|
1796
1799
|
mMath = rb_define_module_under(cOCI8, "Math");
|
1797
1800
|
|
1798
1801
|
/* constants for internal use. */
|
@@ -1842,8 +1845,6 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1842
1845
|
rb_define_module_function(mMath, "log10", omath_log10, 1);
|
1843
1846
|
rb_define_module_function(mMath, "sqrt", omath_sqrt, 1);
|
1844
1847
|
|
1845
|
-
rb_define_alloc_func(cOCINumber, onum_s_alloc);
|
1846
|
-
|
1847
1848
|
/* methods of OCI::Number */
|
1848
1849
|
rb_define_global_function("OraNumber", onum_f_new, -1);
|
1849
1850
|
rb_define_method(cOCINumber, "initialize", onum_initialize, -1);
|
@@ -1873,7 +1874,7 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1873
1874
|
rb_define_method(cOCINumber, "to_f", onum_to_f, 0);
|
1874
1875
|
rb_define_method(cOCINumber, "to_r", onum_to_r, 0);
|
1875
1876
|
rb_define_method(cOCINumber, "to_d", onum_to_d, 0);
|
1876
|
-
rb_define_method(cOCINumber, "
|
1877
|
+
rb_define_method(cOCINumber, "has_fractional_part?", onum_has_fractional_part_p, 0);
|
1877
1878
|
rb_define_method(cOCINumber, "to_onum", onum_to_onum, 0);
|
1878
1879
|
|
1879
1880
|
rb_define_method(cOCINumber, "zero?", onum_zero_p, 0);
|
@@ -1902,6 +1903,10 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1902
1903
|
dummy2 = rb_define_class_under(mOCI8BindType, "Integer", cOCI8BindTypeBase);
|
1903
1904
|
dummy3 = rb_define_class_under(mOCI8BindType, "Float", cOCI8BindTypeBase);
|
1904
1905
|
#endif
|
1906
|
+
|
1907
|
+
/* The following method definition is for backward-compatibility.
|
1908
|
+
I misunderstood the name of numbers after a decimal point. */
|
1909
|
+
rb_define_method_nodoc(cOCINumber, "has_decimal_part?", onum_has_fractional_part_p, 0);
|
1905
1910
|
}
|
1906
1911
|
|
1907
1912
|
/*
|