ruby-oci8 2.2.0.2 → 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/.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/oci8lib.c
CHANGED
@@ -7,6 +7,10 @@
|
|
7
7
|
#ifdef HAVE_RUBY_THREAD_H
|
8
8
|
#include <ruby/thread.h>
|
9
9
|
#endif
|
10
|
+
#if defined(HAVE_PLTHOOK) && !defined(WIN32)
|
11
|
+
#include <dlfcn.h>
|
12
|
+
#include "plthook.h"
|
13
|
+
#endif
|
10
14
|
|
11
15
|
ID oci8_id_at_last_error;
|
12
16
|
ID oci8_id_get;
|
@@ -54,7 +58,6 @@ void oci8_base_free(oci8_base_t *base)
|
|
54
58
|
base->hp.ptr = NULL;
|
55
59
|
}
|
56
60
|
|
57
|
-
#ifdef HAVE_RB_SET_END_PROC
|
58
61
|
static void at_exit_func(VALUE val)
|
59
62
|
{
|
60
63
|
oci8_in_finalizer = 1;
|
@@ -62,21 +65,136 @@ static void at_exit_func(VALUE val)
|
|
62
65
|
oci8_shutdown_sockets();
|
63
66
|
#endif
|
64
67
|
}
|
65
|
-
#endif
|
66
68
|
|
67
69
|
static VALUE bind_base_alloc(VALUE klass)
|
68
70
|
{
|
69
71
|
rb_raise(rb_eNameError, "private method `new' called for %s:Class", rb_class2name(klass));
|
70
72
|
}
|
71
73
|
|
74
|
+
#if defined(HAVE_PLTHOOK) && !defined(WIN32) && !defined(__CYGWIN__) && !defined(TRUFFLERUBY)
|
75
|
+
static const char *find_libclntsh(void *handle)
|
76
|
+
{
|
77
|
+
void *symaddr = dlsym(handle, "OCIEnvCreate");
|
78
|
+
Dl_info info;
|
79
|
+
#ifdef __APPLE__
|
80
|
+
const char *basename = "libclntsh.dylib";
|
81
|
+
#else
|
82
|
+
const char *basename = "libclntsh.so";
|
83
|
+
#endif
|
84
|
+
const char *p;
|
85
|
+
|
86
|
+
if (symaddr == NULL) {
|
87
|
+
return NULL;
|
88
|
+
}
|
89
|
+
if (dladdr(symaddr, &info) == 0) {
|
90
|
+
return NULL;
|
91
|
+
}
|
92
|
+
if ((p = strrchr(info.dli_fname, '/')) == NULL) {
|
93
|
+
return NULL;
|
94
|
+
}
|
95
|
+
if (strncmp(p + 1, basename, strlen(basename)) != 0) {
|
96
|
+
return NULL;
|
97
|
+
}
|
98
|
+
return info.dli_fname;
|
99
|
+
}
|
100
|
+
|
101
|
+
/*
|
102
|
+
* Symbol prefix depends on the platform.
|
103
|
+
* Linux x86_64 - no prefix
|
104
|
+
* Linux x86_32 - "_"
|
105
|
+
* macOS - "@_"
|
106
|
+
*/
|
107
|
+
static const char *find_symbol_prefix(plthook_t *ph, size_t *len)
|
108
|
+
{
|
109
|
+
unsigned int pos = 0;
|
110
|
+
const char *name;
|
111
|
+
void **addr;
|
112
|
+
|
113
|
+
while (plthook_enum(ph, &pos, &name, &addr) == 0) {
|
114
|
+
const char *p = strstr(name, "OCIEnvCreate");
|
115
|
+
if (p != NULL) {
|
116
|
+
*len = p - name;
|
117
|
+
return name;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
return NULL;
|
121
|
+
}
|
122
|
+
|
123
|
+
/*
|
124
|
+
* Fix PLT entries against function interposition.
|
125
|
+
* See: http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/ldap-auth-and-function-interposition.md
|
126
|
+
*/
|
127
|
+
static void rebind_internal_symbols(void)
|
128
|
+
{
|
129
|
+
const char *libfile;
|
130
|
+
void *handle;
|
131
|
+
int flags = RTLD_LAZY | RTLD_NOLOAD;
|
132
|
+
plthook_t *ph;
|
133
|
+
unsigned int pos = 0;
|
134
|
+
const char *name;
|
135
|
+
void **addr;
|
136
|
+
const char *prefix;
|
137
|
+
size_t prefix_len;
|
138
|
+
|
139
|
+
#ifdef RTLD_FIRST
|
140
|
+
flags |= RTLD_FIRST; /* for macOS */
|
141
|
+
#endif
|
142
|
+
|
143
|
+
libfile = find_libclntsh(RTLD_DEFAULT); /* normal case */
|
144
|
+
if (libfile == NULL) {
|
145
|
+
libfile = find_libclntsh(RTLD_NEXT); /* special case when OCIEnvCreate is hooked by LD_PRELOAD */
|
146
|
+
}
|
147
|
+
if (libfile == NULL) {
|
148
|
+
return;
|
149
|
+
}
|
150
|
+
handle = dlopen(libfile, flags);
|
151
|
+
if (handle == NULL) {
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
if (plthook_open(&ph, libfile) != 0) {
|
155
|
+
dlclose(handle);
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
prefix = find_symbol_prefix(ph, &prefix_len);
|
159
|
+
if (prefix == NULL) {
|
160
|
+
dlclose(handle);
|
161
|
+
plthook_close(ph);
|
162
|
+
return;
|
163
|
+
}
|
164
|
+
while (plthook_enum(ph, &pos, &name, &addr) == 0) {
|
165
|
+
void *funcaddr;
|
166
|
+
if (prefix_len != 0) {
|
167
|
+
if (strncmp(name, prefix, prefix_len) != 0) {
|
168
|
+
continue;
|
169
|
+
}
|
170
|
+
name += prefix_len;
|
171
|
+
}
|
172
|
+
if (strncmp(name, "OCI", 3) == 0) {
|
173
|
+
/* exclude functions starting with OCI not to prevent LD_PRELOAD hooking */
|
174
|
+
continue;
|
175
|
+
}
|
176
|
+
funcaddr = dlsym(handle, name);
|
177
|
+
if (funcaddr != NULL && *addr != funcaddr) {
|
178
|
+
/* If libclntsh.so exports and imports same functions, their
|
179
|
+
* PLT entries are forcedly modified to point to itself not
|
180
|
+
* to use functions in other libraries.
|
181
|
+
*/
|
182
|
+
*addr = funcaddr;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
plthook_close(ph);
|
186
|
+
dlclose(handle);
|
187
|
+
}
|
188
|
+
#endif
|
189
|
+
|
72
190
|
#ifdef _WIN32
|
73
191
|
__declspec(dllexport)
|
74
192
|
#endif
|
75
193
|
void
|
76
|
-
Init_oci8lib()
|
194
|
+
Init_oci8lib(void)
|
77
195
|
{
|
78
196
|
VALUE cOCI8;
|
79
|
-
OCIEnv *envhp;
|
197
|
+
OCIEnv *envhp = NULL;
|
80
198
|
OCIError *errhp;
|
81
199
|
sword rv;
|
82
200
|
|
@@ -108,6 +226,9 @@ Init_oci8lib()
|
|
108
226
|
oracle_client_version = ORAVERNUM(major, minor, update, patch, port_update);
|
109
227
|
}
|
110
228
|
#endif
|
229
|
+
#if defined(HAVE_PLTHOOK) && !defined(WIN32) && !defined(__CYGWIN__) && !defined(TRUFFLERUBY)
|
230
|
+
rebind_internal_symbols();
|
231
|
+
#endif
|
111
232
|
|
112
233
|
oci8_id_at_last_error = rb_intern("@last_error");
|
113
234
|
oci8_id_get = rb_intern("get");
|
@@ -118,9 +239,7 @@ Init_oci8lib()
|
|
118
239
|
oci8_id_mul_op = rb_intern("*");
|
119
240
|
oci8_id_div_op = rb_intern("/");
|
120
241
|
#endif
|
121
|
-
#ifdef HAVE_RB_SET_END_PROC
|
122
242
|
rb_set_end_proc(at_exit_func, Qnil);
|
123
|
-
#endif
|
124
243
|
|
125
244
|
Init_oci8_thread_util();
|
126
245
|
Init_oci8_error();
|
@@ -157,7 +276,11 @@ Init_oci8lib()
|
|
157
276
|
/* allocate a temporary errhp to pass Init_oci_number() */
|
158
277
|
rv = OCIEnvCreate(&envhp, oci8_env_mode, NULL, NULL, NULL, NULL, 0, NULL);
|
159
278
|
if (rv != OCI_SUCCESS) {
|
160
|
-
|
279
|
+
if (envhp != NULL) {
|
280
|
+
oci8_env_free_and_raise(envhp, rv);
|
281
|
+
} else {
|
282
|
+
oci8_raise_init_error();
|
283
|
+
}
|
161
284
|
}
|
162
285
|
rv = OCIHandleAlloc(envhp, (dvoid *)&errhp, OCI_HTYPE_ERROR, 0, NULL);
|
163
286
|
if (rv != OCI_SUCCESS)
|
@@ -338,6 +461,7 @@ sword oci8_call_without_gvl(oci8_svcctx_t *svcctx, void *(*func)(void *), void *
|
|
338
461
|
parg.func = func;
|
339
462
|
parg.data = data;
|
340
463
|
rv = (sword)rb_protect(protected_call, (VALUE)&parg, &state);
|
464
|
+
RB_OBJ_WRITE(svcctx->base.self, &svcctx->executing_thread, Qnil);
|
341
465
|
if (state) {
|
342
466
|
rb_jump_tag(state);
|
343
467
|
}
|
@@ -358,8 +482,8 @@ typedef struct {
|
|
358
482
|
OCIStmt *stmtp;
|
359
483
|
} cb_arg_t;
|
360
484
|
|
361
|
-
static VALUE exec_sql(
|
362
|
-
static VALUE ensure_func(
|
485
|
+
static VALUE exec_sql(VALUE varg);
|
486
|
+
static VALUE ensure_func(VALUE varg);
|
363
487
|
|
364
488
|
/*
|
365
489
|
* utility function to execute a single SQL statement
|
@@ -380,17 +504,14 @@ sword oci8_exec_sql(oci8_svcctx_t *svcctx, const char *sql_text, ub4 num_define_
|
|
380
504
|
return (sword)rb_ensure(exec_sql, (VALUE)&arg, ensure_func, (VALUE)&arg);
|
381
505
|
}
|
382
506
|
|
383
|
-
static VALUE exec_sql(
|
507
|
+
static VALUE exec_sql(VALUE varg)
|
384
508
|
{
|
509
|
+
cb_arg_t *arg = (cb_arg_t *)varg;
|
385
510
|
ub4 pos;
|
386
511
|
sword rv;
|
387
512
|
|
388
|
-
rv = OCIHandleAlloc(oci8_envhp, (dvoid*)&arg->stmtp, OCI_HTYPE_STMT, 0, NULL);
|
389
|
-
if (rv != OCI_SUCCESS) {
|
390
|
-
oci8_env_raise(oci8_envhp, rv);
|
391
|
-
}
|
392
513
|
chker2(OCIStmtPrepare2(arg->svcctx->base.hp.svc, &arg->stmtp, oci8_errhp,
|
393
|
-
(text*)arg->sql_text, strlen(arg->sql_text), NULL, 0,
|
514
|
+
(text*)arg->sql_text, (ub4)strlen(arg->sql_text), NULL, 0,
|
394
515
|
OCI_NTV_SYNTAX, OCI_DEFAULT),
|
395
516
|
&arg->svcctx->base);
|
396
517
|
for (pos = 0; pos < arg->num_define_vars; pos++) {
|
@@ -427,8 +548,9 @@ static VALUE exec_sql(cb_arg_t *arg)
|
|
427
548
|
return (VALUE)rv;
|
428
549
|
}
|
429
550
|
|
430
|
-
static VALUE ensure_func(
|
551
|
+
static VALUE ensure_func(VALUE varg)
|
431
552
|
{
|
553
|
+
cb_arg_t *arg = (cb_arg_t *)varg;
|
432
554
|
if (arg->stmtp != NULL) {
|
433
555
|
OCIStmtRelease(arg->stmtp, oci8_errhp, NULL, 0, OCI_DEFAULT);
|
434
556
|
}
|
@@ -439,6 +561,24 @@ static VALUE ensure_func(cb_arg_t *arg)
|
|
439
561
|
|
440
562
|
#ifndef _WIN32
|
441
563
|
#include <dlfcn.h>
|
564
|
+
static void *load_file(const char *filename, int flags, VALUE errors)
|
565
|
+
{
|
566
|
+
void *handle = dlopen(filename, flags);
|
567
|
+
|
568
|
+
if (handle == NULL) {
|
569
|
+
char *err = dlerror();
|
570
|
+
VALUE msg;
|
571
|
+
|
572
|
+
if (strstr(err, filename) == NULL) {
|
573
|
+
msg = rb_sprintf("%s: %s", filename, err);
|
574
|
+
msg = rb_enc_associate_index(msg, rb_locale_encindex());
|
575
|
+
} else {
|
576
|
+
msg = rb_locale_str_new_cstr(err);
|
577
|
+
}
|
578
|
+
rb_ary_push(errors, msg);
|
579
|
+
}
|
580
|
+
return handle;
|
581
|
+
}
|
442
582
|
#endif
|
443
583
|
|
444
584
|
void *oci8_find_symbol(const char *symbol_name)
|
@@ -481,58 +621,50 @@ void *oci8_find_symbol(const char *symbol_name)
|
|
481
621
|
"libclntsh.sl.12.1",
|
482
622
|
"libclntsh.sl.11.1",
|
483
623
|
"libclntsh.sl.10.1",
|
484
|
-
"libclntsh.sl.9.0",
|
485
|
-
"libclntsh.sl.8.0",
|
486
624
|
#elif defined(__APPLE__)
|
487
625
|
/* Mac OS X */
|
626
|
+
"libclntsh.dylib",
|
488
627
|
"libclntsh.dylib.12.1",
|
489
628
|
"libclntsh.dylib.11.1",
|
490
629
|
"libclntsh.dylib.10.1",
|
491
630
|
#else
|
492
631
|
/* Linux, Solaris and HP-UX(IA64) */
|
632
|
+
"libclntsh.so",
|
493
633
|
"libclntsh.so.12.1",
|
494
634
|
"libclntsh.so.11.1",
|
495
635
|
"libclntsh.so.10.1",
|
496
|
-
"libclntsh.so.9.0",
|
497
|
-
"libclntsh.so.8.0",
|
498
636
|
#endif
|
499
637
|
};
|
500
638
|
#define NUM_SONAMES (sizeof(sonames)/sizeof(sonames[0]))
|
639
|
+
#if defined(_AIX) /* AIX */
|
640
|
+
#define BASE_SONAME "libclntsh.a(shr.o)"
|
641
|
+
#elif defined(__hppa) /* HP-UX(PA-RISC) */
|
642
|
+
#define BASE_SONAME "libclntsh.sl"
|
643
|
+
#elif !defined(__CYGWIN__) && !defined(__APPLE__)
|
644
|
+
#define BASE_SONAME "libclntsh.so"
|
645
|
+
#endif
|
501
646
|
size_t idx;
|
502
|
-
|
647
|
+
VALUE err = rb_ary_new();
|
503
648
|
|
504
649
|
#ifdef _AIX
|
505
650
|
#define DLOPEN_FLAG (RTLD_LAZY|RTLD_GLOBAL|RTLD_MEMBER)
|
506
651
|
#else
|
507
652
|
#define DLOPEN_FLAG (RTLD_LAZY|RTLD_GLOBAL)
|
508
653
|
#endif
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
654
|
+
#ifdef BASE_SONAME
|
655
|
+
char *oracle_home = getenv("ORACLE_HOME");
|
656
|
+
|
657
|
+
if (oracle_home != NULL) {
|
658
|
+
VALUE fname = rb_str_buf_cat2(rb_str_buf_new_cstr(oracle_home), "/lib/" BASE_SONAME);
|
659
|
+
handle = load_file(StringValueCStr(fname), DLOPEN_FLAG, err);
|
660
|
+
RB_GC_GUARD(fname);
|
661
|
+
}
|
662
|
+
#endif
|
663
|
+
for (idx = 0; handle == NULL && idx < NUM_SONAMES; idx++) {
|
664
|
+
handle = load_file(sonames[idx], DLOPEN_FLAG, err);
|
515
665
|
}
|
516
666
|
if (handle == NULL) {
|
517
|
-
VALUE msg;
|
518
|
-
const VALUE *arr = RARRAY_CONST_PTR(err);
|
519
|
-
|
520
|
-
msg = rb_str_buf_new(NUM_SONAMES * 50);
|
521
|
-
for (idx = 0; idx < NUM_SONAMES; idx++) {
|
522
|
-
const char *errmsg = RSTRING_PTR(arr[idx]);
|
523
|
-
if (idx != 0) {
|
524
|
-
rb_str_buf_cat2(msg, " ");
|
525
|
-
}
|
526
|
-
if (strstr(errmsg, sonames[idx]) == NULL) {
|
527
|
-
/* prepend "soname: " if soname is not found in
|
528
|
-
* the error message.
|
529
|
-
*/
|
530
|
-
rb_str_buf_cat2(msg, sonames[idx]);
|
531
|
-
rb_str_buf_cat2(msg, ": ");
|
532
|
-
}
|
533
|
-
rb_str_buf_append(msg, arr[idx]);
|
534
|
-
rb_str_buf_cat2(msg, ";");
|
535
|
-
}
|
667
|
+
VALUE msg = rb_ary_join(err, rb_usascii_str_new_cstr("; "));
|
536
668
|
rb_exc_raise(rb_exc_new3(rb_eLoadError, msg));
|
537
669
|
}
|
538
670
|
}
|
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
|
*
|