ruby-oci8 2.2.0.2 → 2.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +1 -6
- data/ChangeLog +600 -0
- data/NEWS +426 -35
- data/README.md +27 -9
- data/dist-files +13 -2
- data/docs/bind-array-to-in_cond.md +38 -0
- data/docs/conflicts-local-connections-and-processes.md +98 -0
- 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 -117
- 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 +11 -8
- data/docs/timeout-parameters.md +94 -0
- data/ext/oci8/apiwrap.c.tmpl +2 -5
- data/ext/oci8/apiwrap.rb +6 -1
- data/ext/oci8/apiwrap.yml +39 -143
- data/ext/oci8/attr.c +4 -2
- data/ext/oci8/bind.c +421 -9
- 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 +35 -63
- data/ext/oci8/hook_funcs.c +274 -61
- data/ext/oci8/lob.c +31 -75
- data/ext/oci8/metadata.c +8 -6
- data/ext/oci8/object.c +119 -29
- data/ext/oci8/oci8.c +46 -133
- data/ext/oci8/oci8.h +40 -123
- data/ext/oci8/oci8lib.c +178 -46
- data/ext/oci8/ocihandle.c +37 -37
- data/ext/oci8/ocinumber.c +24 -35
- data/ext/oci8/oraconf.rb +168 -337
- 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 +16 -1
- data/ext/oci8/stmt.c +52 -17
- data/ext/oci8/win32.c +4 -22
- data/lib/oci8/bindtype.rb +10 -17
- data/lib/oci8/check_load_error.rb +57 -10
- data/lib/oci8/compat.rb +5 -1
- data/lib/oci8/connection_pool.rb +74 -3
- data/lib/oci8/cursor.rb +70 -31
- data/lib/oci8/metadata.rb +9 -1
- data/lib/oci8/object.rb +14 -1
- data/lib/oci8/oci8.rb +184 -58
- data/lib/oci8/ocihandle.rb +0 -16
- data/lib/oci8/oracle_version.rb +11 -1
- data/lib/oci8/properties.rb +55 -0
- data/lib/oci8/version.rb +1 -1
- data/lib/oci8.rb +48 -4
- data/lib/ruby-oci8.rb +1 -0
- data/pre-distclean.rb +1 -3
- data/ruby-oci8.gemspec +4 -9
- data/setup.rb +11 -2
- data/test/README.md +37 -0
- data/test/config.rb +8 -1
- data/test/setup_test_object.sql +42 -14
- data/test/setup_test_package.sql +59 -0
- data/test/test_all.rb +4 -0
- data/test/test_bind_array.rb +70 -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 +5 -17
- data/test/test_connstr.rb +142 -0
- data/test/test_datetime.rb +8 -3
- data/test/test_metadata.rb +2 -1
- data/test/test_object.rb +99 -18
- data/test/test_oci8.rb +170 -46
- data/test/test_oranumber.rb +12 -6
- data/test/test_package_type.rb +17 -3
- data/test/test_properties.rb +17 -0
- metadata +45 -55
- data/docs/osx-install-dev-tools.png +0 -0
- data/test/README +0 -42
data/ext/oci8/ocinumber.c
CHANGED
@@ -23,10 +23,8 @@ static ID id_finite_p;
|
|
23
23
|
static ID id_split;
|
24
24
|
static ID id_numerator;
|
25
25
|
static ID id_denominator;
|
26
|
-
static ID id_Rational;
|
27
26
|
static ID id_BigDecimal;
|
28
27
|
|
29
|
-
static VALUE cRational;
|
30
28
|
static VALUE cBigDecimal;
|
31
29
|
|
32
30
|
static VALUE cOCINumber;
|
@@ -51,19 +49,6 @@ static int rboci8_type(VALUE obj)
|
|
51
49
|
VALUE klass;
|
52
50
|
|
53
51
|
switch (type) {
|
54
|
-
case T_OBJECT:
|
55
|
-
klass = CLASS_OF(obj);
|
56
|
-
if (cRational != 0) {
|
57
|
-
if (klass == cRational) {
|
58
|
-
return T_RATIONAL;
|
59
|
-
}
|
60
|
-
} else {
|
61
|
-
if (strcmp(rb_class2name(klass), "Rational") == 0) {
|
62
|
-
cRational = rb_const_get(rb_cObject, id_Rational);
|
63
|
-
return T_RATIONAL;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
break;
|
67
52
|
case T_DATA:
|
68
53
|
klass = CLASS_OF(obj);
|
69
54
|
if (klass == cOCINumber) {
|
@@ -169,7 +154,7 @@ static void set_oci_number_from_str(OCINumber *result, VALUE str, VALUE fmt, VAL
|
|
169
154
|
StringValue(str);
|
170
155
|
/* set from string. */
|
171
156
|
if (NIL_P(fmt)) {
|
172
|
-
int rv = oranumber_from_str(result, RSTRING_PTR(str),
|
157
|
+
int rv = oranumber_from_str(result, RSTRING_PTR(str), RSTRING_LENINT(str));
|
173
158
|
if (rv == ORANUMBER_SUCCESS) {
|
174
159
|
return; /* success */
|
175
160
|
} else {
|
@@ -187,17 +172,17 @@ static void set_oci_number_from_str(OCINumber *result, VALUE str, VALUE fmt, VAL
|
|
187
172
|
}
|
188
173
|
StringValue(fmt);
|
189
174
|
fmt_ptr = RSTRING_ORATEXT(fmt);
|
190
|
-
fmt_len =
|
175
|
+
fmt_len = RSTRING_LENINT(fmt);
|
191
176
|
if (NIL_P(nls_params)) {
|
192
177
|
nls_params_ptr = NULL;
|
193
178
|
nls_params_len = 0;
|
194
179
|
} else {
|
195
180
|
StringValue(nls_params);
|
196
181
|
nls_params_ptr = RSTRING_ORATEXT(nls_params);
|
197
|
-
nls_params_len =
|
182
|
+
nls_params_len = RSTRING_LENINT(nls_params);
|
198
183
|
}
|
199
184
|
chkerr(OCINumberFromText(errhp,
|
200
|
-
RSTRING_ORATEXT(str),
|
185
|
+
RSTRING_ORATEXT(str), RSTRING_LENINT(str),
|
201
186
|
fmt_ptr, fmt_len, nls_params_ptr, nls_params_len,
|
202
187
|
result));
|
203
188
|
}
|
@@ -231,6 +216,8 @@ static int set_oci_number_from_num(OCINumber *result, VALUE num, int force, OCIE
|
|
231
216
|
num = rb_big2str(num, 10);
|
232
217
|
set_oci_number_from_str(result, num, Qnil, Qnil, errhp);
|
233
218
|
return 1;
|
219
|
+
default:
|
220
|
+
break;
|
234
221
|
}
|
235
222
|
if (RTEST(rb_obj_is_instance_of(num, cOCINumber))) {
|
236
223
|
/* OCI::Number */
|
@@ -262,7 +249,7 @@ static int set_oci_number_from_num(OCINumber *result, VALUE num, int force, OCIE
|
|
262
249
|
if (TYPE(ary[1]) != T_STRING) {
|
263
250
|
goto is_not_big_decimal;
|
264
251
|
}
|
265
|
-
digits_len =
|
252
|
+
digits_len = RSTRING_LENINT(ary[1]);
|
266
253
|
set_oci_number_from_str(&digits, ary[1], Qnil, Qnil, errhp);
|
267
254
|
/* check base */
|
268
255
|
if (TYPE(ary[2]) != T_FIXNUM || FIX2LONG(ary[2]) != 10) {
|
@@ -378,7 +365,7 @@ OCINumber *oci8_dbl_to_onum(OCINumber *result, double dbl, OCIError *errhp)
|
|
378
365
|
sword rv;
|
379
366
|
|
380
367
|
str = rb_obj_as_string(rb_float_new(dbl));
|
381
|
-
rv = oranumber_from_str(result, RSTRING_PTR(str),
|
368
|
+
rv = oranumber_from_str(result, RSTRING_PTR(str), RSTRING_LENINT(str));
|
382
369
|
if (rv != 0) {
|
383
370
|
oci8_raise_by_msgno(rv, NULL);
|
384
371
|
}
|
@@ -1322,14 +1309,14 @@ static VALUE onum_to_char(int argc, VALUE *argv, VALUE self)
|
|
1322
1309
|
}
|
1323
1310
|
StringValue(fmt);
|
1324
1311
|
fmt_ptr = RSTRING_ORATEXT(fmt);
|
1325
|
-
fmt_len =
|
1312
|
+
fmt_len = RSTRING_LENINT(fmt);
|
1326
1313
|
if (NIL_P(nls_params)) {
|
1327
1314
|
nls_params_ptr = NULL;
|
1328
1315
|
nls_params_len = 0;
|
1329
1316
|
} else {
|
1330
1317
|
StringValue(nls_params);
|
1331
1318
|
nls_params_ptr = RSTRING_ORATEXT(nls_params);
|
1332
|
-
nls_params_len =
|
1319
|
+
nls_params_len = RSTRING_LENINT(nls_params);
|
1333
1320
|
}
|
1334
1321
|
rv = OCINumberToText(errhp, _NUMBER(self),
|
1335
1322
|
fmt_ptr, fmt_len, nls_params_ptr, nls_params_len,
|
@@ -1444,29 +1431,29 @@ static VALUE onum_to_d_real(OCINumber *num, OCIError *errhp)
|
|
1444
1431
|
{
|
1445
1432
|
char buf[64];
|
1446
1433
|
ub4 buf_size = sizeof(buf);
|
1447
|
-
const char *fmt = "FM9.
|
1434
|
+
const char *fmt = "FM9.09999999999999999999999999999999999999EEEE";
|
1448
1435
|
|
1449
1436
|
if (!cBigDecimal) {
|
1450
1437
|
rb_require("bigdecimal");
|
1451
1438
|
cBigDecimal = rb_const_get(rb_cObject, id_BigDecimal);
|
1452
1439
|
}
|
1453
|
-
chkerr(OCINumberToText(errhp, num, (const oratext *)fmt, strlen(fmt),
|
1440
|
+
chkerr(OCINumberToText(errhp, num, (const oratext *)fmt, (ub4)strlen(fmt),
|
1454
1441
|
NULL, 0, &buf_size, TO_ORATEXT(buf)));
|
1455
1442
|
return rb_funcall(rb_cObject, id_BigDecimal, 1, rb_usascii_str_new(buf, buf_size));
|
1456
1443
|
}
|
1457
1444
|
|
1458
1445
|
/*
|
1459
|
-
* @overload
|
1446
|
+
* @overload has_fractional_part?
|
1460
1447
|
*
|
1461
|
-
* Returns <code>true</code> if <i>self</i> has a
|
1448
|
+
* Returns <code>true</code> if <i>self</i> has a fractional part.
|
1462
1449
|
*
|
1463
1450
|
* @example
|
1464
|
-
* OraNumber(10).
|
1465
|
-
* OraNumber(10.1).
|
1451
|
+
* OraNumber(10).has_fractional_part? # => false
|
1452
|
+
* OraNumber(10.1).has_fractional_part? # => true
|
1466
1453
|
*
|
1467
|
-
* @since 2.
|
1454
|
+
* @since 2.2.5
|
1468
1455
|
*/
|
1469
|
-
static VALUE
|
1456
|
+
static VALUE onum_has_fractional_part_p(VALUE self)
|
1470
1457
|
{
|
1471
1458
|
OCIError *errhp = oci8_errhp;
|
1472
1459
|
boolean result;
|
@@ -1805,10 +1792,10 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1805
1792
|
id_split = rb_intern("split");
|
1806
1793
|
id_numerator = rb_intern("numerator");
|
1807
1794
|
id_denominator = rb_intern("denominator");
|
1808
|
-
id_Rational = rb_intern("Rational");
|
1809
1795
|
id_BigDecimal = rb_intern("BigDecimal");
|
1810
1796
|
|
1811
1797
|
cOCINumber = rb_define_class("OraNumber", rb_cNumeric);
|
1798
|
+
rb_define_alloc_func(cOCINumber, onum_s_alloc);
|
1812
1799
|
mMath = rb_define_module_under(cOCI8, "Math");
|
1813
1800
|
|
1814
1801
|
/* constants for internal use. */
|
@@ -1858,8 +1845,6 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1858
1845
|
rb_define_module_function(mMath, "log10", omath_log10, 1);
|
1859
1846
|
rb_define_module_function(mMath, "sqrt", omath_sqrt, 1);
|
1860
1847
|
|
1861
|
-
rb_define_alloc_func(cOCINumber, onum_s_alloc);
|
1862
|
-
|
1863
1848
|
/* methods of OCI::Number */
|
1864
1849
|
rb_define_global_function("OraNumber", onum_f_new, -1);
|
1865
1850
|
rb_define_method(cOCINumber, "initialize", onum_initialize, -1);
|
@@ -1889,7 +1874,7 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1889
1874
|
rb_define_method(cOCINumber, "to_f", onum_to_f, 0);
|
1890
1875
|
rb_define_method(cOCINumber, "to_r", onum_to_r, 0);
|
1891
1876
|
rb_define_method(cOCINumber, "to_d", onum_to_d, 0);
|
1892
|
-
rb_define_method(cOCINumber, "
|
1877
|
+
rb_define_method(cOCINumber, "has_fractional_part?", onum_has_fractional_part_p, 0);
|
1893
1878
|
rb_define_method(cOCINumber, "to_onum", onum_to_onum, 0);
|
1894
1879
|
|
1895
1880
|
rb_define_method(cOCINumber, "zero?", onum_zero_p, 0);
|
@@ -1918,6 +1903,10 @@ Init_oci_number(VALUE cOCI8, OCIError *errhp)
|
|
1918
1903
|
dummy2 = rb_define_class_under(mOCI8BindType, "Integer", cOCI8BindTypeBase);
|
1919
1904
|
dummy3 = rb_define_class_under(mOCI8BindType, "Float", cOCI8BindTypeBase);
|
1920
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);
|
1921
1910
|
}
|
1922
1911
|
|
1923
1912
|
/*
|