ruby-oci8 2.1.7 → 2.1.8
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.
- data/ChangeLog +136 -0
- data/NEWS +61 -0
- data/README.md +2 -2
- data/VERSION +1 -1
- data/dist-files +5 -0
- data/docs/install-instant-client.md +2 -0
- data/ext/oci8/attr.c +0 -9
- data/ext/oci8/bind.c +86 -28
- data/ext/oci8/connection_pool.c +32 -17
- data/ext/oci8/extconf.rb +21 -0
- data/ext/oci8/hook_funcs.c +215 -0
- data/ext/oci8/lob.c +363 -168
- data/ext/oci8/metadata.c +43 -26
- data/ext/oci8/object.c +115 -36
- data/ext/oci8/oci8.c +392 -269
- data/ext/oci8/oci8.h +88 -33
- data/ext/oci8/oci8lib.c +59 -28
- data/ext/oci8/ocidatetime.c +100 -36
- data/ext/oci8/ocihandle.c +288 -286
- data/ext/oci8/ocinumber.c +172 -112
- data/ext/oci8/oradate.c +129 -87
- data/ext/oci8/plthook.h +56 -0
- data/ext/oci8/plthook_elf.c +537 -0
- data/ext/oci8/plthook_osx.c +474 -0
- data/ext/oci8/plthook_win32.c +376 -0
- data/ext/oci8/stmt.c +112 -75
- data/lib/oci8/cursor.rb +1 -1
- data/lib/oci8/oci8.rb +71 -0
- data/lib/oci8/properties.rb +18 -3
- metadata +10 -16
data/ChangeLog
CHANGED
@@ -1,3 +1,139 @@
|
|
1
|
+
2015-04-04 Kubo Takehiro <kubo@jiubao.org>
|
2
|
+
* NEWS: add changes between 2.1.7 and 2.1.8.
|
3
|
+
* VERSION: update to 2.1.8.
|
4
|
+
* dist-files: add new files.
|
5
|
+
|
6
|
+
2015-04-04 Kubo Takehiro <kubo@jiubao.org>
|
7
|
+
* ext/oci8/extconf.rb, ext/oci8/oci8.h: Add a macro for old rubies which
|
8
|
+
don't have rb_str_set_len().
|
9
|
+
* ext/oci8/hook_funcs.c: Suppress a warning.
|
10
|
+
|
11
|
+
2015-04-04 Kubo Takehiro <kubo@jiubao.org>
|
12
|
+
* ext/oci8/lob.c: Increase the buffer size to read a LOB.
|
13
|
+
|
14
|
+
2015-04-04 Kubo Takehiro <kubo@jiubao.org>
|
15
|
+
* docs/install-instant-client.md, ext/oci8/lob.c, ext/oci8/metadata.c,
|
16
|
+
ext/oci8/oci8.c: Update documents for YARD.
|
17
|
+
|
18
|
+
2015-04-02 Kubo Takehiro <kubo@jiubao.org>
|
19
|
+
* ext/oci8/lob.c: Fix SEGV when a temporary LOB is freed by GC
|
20
|
+
while reading another lob and the ruby version is 2.0.0 or
|
21
|
+
upper.
|
22
|
+
|
23
|
+
2015-03-01 Kubo Takehiro <kubo@jiubao.org>
|
24
|
+
* lib/oci8/cursor.rb, lib/oci8/properties.rb:
|
25
|
+
Fix errors while generating documents by yard such as
|
26
|
+
"Exception occurred while generating 'OCI8/Cursor.html'."
|
27
|
+
|
28
|
+
2015-03-01 Kubo Takehiro <kubo@jiubao.org>
|
29
|
+
* ext/oci8/oci8.c, ext/oci8/oci8.h: Rollback transactions on
|
30
|
+
logoff only when the transactions are in progress.
|
31
|
+
|
32
|
+
2015-01-27 Kubo Takehiro <kubo@jiubao.org>
|
33
|
+
* ext/oci8/ocihandle.c, ext/oci8/ocinumber.c, ext/oci8/oradate.c,
|
34
|
+
ext/oci8/stmt.c: Suppreess warnings: "[warn]: @param tag has unknown parameter name: xxx"
|
35
|
+
by yard.
|
36
|
+
|
37
|
+
2015-01-20 Kubo Takehiro <kubo@jiubao.org>
|
38
|
+
* lib/oci8/oci8.rb: Add OCI8#send_timeout, OCI8#send_timeout=,
|
39
|
+
OCI8#recv_timeout and OCI8#recv_timeout=.
|
40
|
+
|
41
|
+
2015-01-20 Kubo Takehiro <kubo@jiubao.org>
|
42
|
+
* ext/oci8/hook_funcs.c, ext/oci8/oci8.c, ext/oci8/oci8.h:
|
43
|
+
Fix for cancel_read_at_exit on Windows.
|
44
|
+
|
45
|
+
2015-01-20 Kubo Takehiro <kubo@jiubao.org>
|
46
|
+
* ext/oci8/oci8.c, ext/oci8/oci8lib.c, lib/oci8/properties.rb:
|
47
|
+
Add OCI8.properties[:cancel_read_at_exit].
|
48
|
+
|
49
|
+
2015-01-20 Kubo Takehiro <kubo@jiubao.org>
|
50
|
+
* ext/oci8/extconf.rb, ext/oci8/hook_funcs.c, ext/oci8/oci8.c,
|
51
|
+
ext/oci8/oci8.h, ext/oci8/oci8lib.c, ext/oci8/plthook.h,
|
52
|
+
ext/oci8/plthook_elf.c, ext/oci8/plthook_osx.c,
|
53
|
+
ext/oci8/plthook_win32.c: Cancel read system calls at exit
|
54
|
+
not to block ruby process termination.
|
55
|
+
This works on Linux, OSX and Windows Vista or upper.
|
56
|
+
(github issue #56)
|
57
|
+
|
58
|
+
2015-01-12 Kubo Takehiro <kubo@jiubao.org>
|
59
|
+
* README.md: Fix a broken link.
|
60
|
+
(github issue #67 reported by Zloy)
|
61
|
+
|
62
|
+
2014-12-30 Kubo Takehiro <kubo@jiubao.org>
|
63
|
+
* ext/oci8/lob.c, ext/oci8/oci8lib.c: Revise type checking of LOB.
|
64
|
+
|
65
|
+
2014-12-30 Kubo Takehiro <kubo@jiubao.org>
|
66
|
+
* ext/oci8/bind.c, ext/oci8/connection_pool.c, ext/oci8/lob.c,
|
67
|
+
ext/oci8/metadata.c, ext/oci8/object.c, ext/oci8/oci8.c, ext/oci8/oci8.h,
|
68
|
+
ext/oci8/oci8lib.c, ext/oci8/ocihandle.c, ext/oci8/stmt.c:
|
69
|
+
Add oci8_check_typeddata() and use it instead of oci8_get_handle()
|
70
|
+
and oci8_get_bind().
|
71
|
+
|
72
|
+
2014-12-30 Kubo Takehiro <kubo@jiubao.org>
|
73
|
+
* ext/oci8/oradate.c: Add check_oradate() to check datatype.
|
74
|
+
|
75
|
+
2014-12-30 Kubo Takehiro <kubo@jiubao.org>
|
76
|
+
* ext/oci8/lob.c, ext/oci8/metadata.c, ext/oci8/object.c, ext/oci8/stmt.c:
|
77
|
+
Add more write barriers.
|
78
|
+
|
79
|
+
2014-12-29 Kubo Takehiro <kubo@jiubao.org>
|
80
|
+
* ext/oci8/bind.c, ext/oci8/connection_pool.c, ext/oci8/lob.c,
|
81
|
+
ext/oci8/metadata.c, ext/oci8/object.c, ext/oci8/oci8.c, ext/oci8/oci8.h
|
82
|
+
ext/oci8/oci8lib.c, ext/oci8/ocidatetime.c, ext/oci8/ocihandle.c,
|
83
|
+
ext/oci8/ocinumber.c, ext/oci8/oradate.c, ext/oci8/stmt.c:
|
84
|
+
Use rb_data_type_t as the base type of oci8_handle_data_type_t.
|
85
|
+
|
86
|
+
2014-12-29 Kubo Takehiro <kubo@jiubao.org>
|
87
|
+
* ext/oci8/bind.c, ext/oci8/connection_pool.c, ext/oci8/lob.c,
|
88
|
+
ext/oci8/metadata.c, ext/oci8/object.c, ext/oci8/oci8.c, ext/oci8/oci8.h
|
89
|
+
ext/oci8/oci8lib.c, ext/oci8/ocidatetime.c, ext/oci8/ocihandle.c,
|
90
|
+
ext/oci8/ocinumber.c, ext/oci8/oradate.c, ext/oci8/stmt.c:
|
91
|
+
Rename vtable and vptr to data_type.
|
92
|
+
|
93
|
+
2014-12-29 Kubo Takehiro <kubo@jiubao.org>
|
94
|
+
* ext/oci8/bind.c, ext/oci8/connection_pool.c, ext/oci8/lob.c,
|
95
|
+
ext/oci8/metadata.c, ext/oci8/object.c, ext/oci8/oci8.c, ext/oci8/oci8.h
|
96
|
+
ext/oci8/oci8lib.c, ext/oci8/ocidatetime.c, ext/oci8/ocihandle.c,
|
97
|
+
ext/oci8/ocinumber.c, ext/oci8/oradate.c, ext/oci8/stmt.c:
|
98
|
+
Add oci8_allocate_typeddata() and use it to allocate OCI objects.
|
99
|
+
|
100
|
+
2014-12-23 Kubo Takehiro <kubo@jiubao.org>
|
101
|
+
* ext/oci8/connection_pool.c, ext/oci8/metadata.c, ext/oci8/object.c,
|
102
|
+
ext/oci8/oci8.c, ext/oci8/oci8.h, ext/oci8/oci8lib.c, ext/oci8/ocihandle.c
|
103
|
+
ext/oci8/ocinumber.c, ext/oci8/oradate.c, ext/oci8/stmt.c:
|
104
|
+
Add write barriers to use generational GC.
|
105
|
+
|
106
|
+
2014-12-23 Kubo Takehiro <kubo@jiubao.org>
|
107
|
+
* ext/oci8/oci8.h, ext/oci8/oci8lib.c, ext/oci8/ocihandle.c,
|
108
|
+
ext/oci8/ocinumber.c, ext/oci8/oradate.c:
|
109
|
+
Use TypedData on ruby 1.9.3 and later.
|
110
|
+
|
111
|
+
2014-12-22 Kubo Takehiro <kubo@jiubao.org>
|
112
|
+
* ext/oci8/extconf.rb, ext/oci8/stmt.c: Don't use SYM2ID on ruby 2.2.0
|
113
|
+
or later. Symbols passed to SYM2ID are not GC'ed.
|
114
|
+
|
115
|
+
2014-12-21 Kubo Takehiro <kubo@jiubao.org>
|
116
|
+
* ext/oci8/bind.c, ext/oci8/object.c, ext/oci8/oci8.h, ext/oci8/oci8lib.c,
|
117
|
+
ext/oci8/ocidatetime.c, ext/oci8/ocihandle.c, ext/oci8/ocinumber.c:
|
118
|
+
Use RARRAY_AREF and RARRAY_CONST_PTR for Generational GC.
|
119
|
+
|
120
|
+
2014-12-06 Kubo Takehiro <kubo@jiubao.org>
|
121
|
+
* ext/oci8/connection_pool.c, ext/oci8/lob.c, ext/oci8/oci8.c,
|
122
|
+
ext/oci8/stmt.c: Fix "RuntimeError:executing in another thread"
|
123
|
+
when a closed connection is used. This bug was introduced by
|
124
|
+
the previous commit.
|
125
|
+
(github issue #64 reported by Yasuo Honda)
|
126
|
+
|
127
|
+
2014-11-16 Kubo Takehiro <kubo@jiubao.org>
|
128
|
+
* ext/oci8/attr.c, ext/oci8/bind.c, ext/oci8/connection_pool.c,
|
129
|
+
ext/oci8/lob.c, ext/oci8/metadata.c, ext/oci8/object.c,
|
130
|
+
ext/oci8/oci8.c, ext/oci8/oci8.h, ext/oci8/oci8lib.c,
|
131
|
+
ext/oci8/ocihandle.c, ext/oci8/stmt.c:
|
132
|
+
Raises an exception when a closed OCI8 object is used.
|
133
|
+
Using a closed cursor causes various problems such as segmentation
|
134
|
+
fault, nil comparison error and so on.
|
135
|
+
(github issue #61 and #62 reported by Mike Bourgeous)
|
136
|
+
|
1
137
|
2014-02-02 Kubo Takehiro <kubo@jiubao.org>
|
2
138
|
* NEWS: add changes between 2.1.7 and 2.1.6.
|
3
139
|
* VERSION: change the version to 2.1.7.
|
data/NEWS
CHANGED
@@ -1,5 +1,66 @@
|
|
1
1
|
# @markup markdown
|
2
2
|
|
3
|
+
2.1.8
|
4
|
+
=====
|
5
|
+
|
6
|
+
New Features
|
7
|
+
------------
|
8
|
+
|
9
|
+
### Send and receive timeouts
|
10
|
+
|
11
|
+
New methods {OCI8#send_timeout}, {OCI8#send_timeout=}, {OCI8#recv_timeout} and {OCI8#recv_timeout=}
|
12
|
+
were added. They are available on Oracle 11.1 or upper.
|
13
|
+
|
14
|
+
Use them at your own risk because they use [undocumented OCI handle attributes](http://blog.jiubao.org/2015/01/undocumented-oci-handle-attributes.html).
|
15
|
+
|
16
|
+
### Cancel read system calls not to prevent ruby process termination
|
17
|
+
|
18
|
+
When network quality is poor and incoming packets are lost irregularly,
|
19
|
+
the ruby process termination may be blocked until TCP keepalive time (2 hours).
|
20
|
+
|
21
|
+
By setting [OCI8.properties[:cancel_read_at_exit]](OCI8.html#properties-class_method)
|
22
|
+
true, read system calls, which may wait incoming packets, are canceled at exit.
|
23
|
+
See: [github issue #56](https://github.com/kubo/ruby-oci8/issues/56)
|
24
|
+
|
25
|
+
This feature is disabled by default because it uses [unusual technique](https://github.com/kubo/plthook)
|
26
|
+
which hooks read system calls issued by Oracle client library and it works only on
|
27
|
+
Linux, Windows and OSX.
|
28
|
+
|
29
|
+
### RGenGC
|
30
|
+
|
31
|
+
Object allocation code is rewritten to use [RGenGC](http://www.infoq.com/news/2013/12/ruby21).
|
32
|
+
|
33
|
+
Fixed Issues
|
34
|
+
------------
|
35
|
+
|
36
|
+
- Raises an exception when a closed OCI8 object is used.
|
37
|
+
Using a closed cursor causes various problems such as segmentation
|
38
|
+
fault, nil comparison error and so on.
|
39
|
+
See: [github issue #61](https://github.com/kubo/ruby-oci8/issues/61)
|
40
|
+
and [github issue #62](https://github.com/kubo/ruby-oci8/issues/62)
|
41
|
+
|
42
|
+
(reported by Mike Bourgeous)
|
43
|
+
|
44
|
+
- Fix "RuntimeError:executing in another thread"
|
45
|
+
when a closed connection is used. This bug was introduced by
|
46
|
+
the previously listed issue.
|
47
|
+
See: [github issue #64](https://github.com/kubo/ruby-oci8/issues/64)
|
48
|
+
|
49
|
+
(reported by Yasuo Honda)
|
50
|
+
|
51
|
+
- Fix SEGV when a temporary LOB is freed by GC while reading another
|
52
|
+
lob and the ruby version is 2.0.0 or upper.
|
53
|
+
|
54
|
+
- Skip rollback on logoff when no transactions are in progress.
|
55
|
+
|
56
|
+
- Fix a broken link in README.md.
|
57
|
+
See: [github issue #67](https://github.com/kubo/ruby-oci8/issues/67)
|
58
|
+
|
59
|
+
(reported by Zloy)
|
60
|
+
|
61
|
+
- Don't use SYM2ID on ruby 2.2.0 or later not to make symbols unGCable
|
62
|
+
by [Symbol GC](http://www.infoq.com/news/2014/12/ruby-2.2.0-released).
|
63
|
+
|
3
64
|
2.1.7
|
4
65
|
=====
|
5
66
|
|
data/README.md
CHANGED
@@ -21,10 +21,10 @@ Connect to scott/tiger, select `emp` and print as CSV format.
|
|
21
21
|
|
22
22
|
If you install a ruby-oci8 gem package, you may need to add `-rubygems` before `-r oci8`.
|
23
23
|
|
24
|
-
|
24
|
+
Documentation
|
25
25
|
=============
|
26
26
|
|
27
|
-
* http://rubydoc.info/gems/ruby-oci8/
|
27
|
+
* http://rubydoc.info/gems/ruby-oci8/
|
28
28
|
|
29
29
|
Installation
|
30
30
|
============
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.8
|
data/dist-files
CHANGED
@@ -29,6 +29,7 @@ ext/oci8/encoding.c
|
|
29
29
|
ext/oci8/env.c
|
30
30
|
ext/oci8/error.c
|
31
31
|
ext/oci8/extconf.rb
|
32
|
+
ext/oci8/hook_funcs.c
|
32
33
|
ext/oci8/lob.c
|
33
34
|
ext/oci8/metadata.c
|
34
35
|
ext/oci8/object.c
|
@@ -42,6 +43,10 @@ ext/oci8/oraconf.rb
|
|
42
43
|
ext/oci8/oradate.c
|
43
44
|
ext/oci8/oranumber_util.c
|
44
45
|
ext/oci8/oranumber_util.h
|
46
|
+
ext/oci8/plthook.h
|
47
|
+
ext/oci8/plthook_elf.c
|
48
|
+
ext/oci8/plthook_osx.c
|
49
|
+
ext/oci8/plthook_win32.c
|
45
50
|
ext/oci8/post-config.rb
|
46
51
|
ext/oci8/stmt.c
|
47
52
|
ext/oci8/thread_util.c
|
@@ -45,6 +45,8 @@ Note:
|
|
45
45
|
* use libclntsh.sl instead of libclntsh.so on HP-UX PA-RISC.
|
46
46
|
* use libclntsh.dylib instead of libclntsh.so on Mac OS X.
|
47
47
|
* skip this step for AIX.
|
48
|
+
* run `yum install libaio` also on Redhat.
|
49
|
+
* run `apt-get install libaio1` also on Ubuntu.
|
48
50
|
|
49
51
|
Set the library search path, whose name depends on the OS, to point to
|
50
52
|
the installed directory.
|
data/ext/oci8/attr.c
CHANGED
@@ -6,15 +6,6 @@
|
|
6
6
|
*/
|
7
7
|
#include "oci8.h"
|
8
8
|
|
9
|
-
VALUE oci8_get_ub2_attr(oci8_base_t *base, ub4 attrtype, OCIStmt *stmtp)
|
10
|
-
{
|
11
|
-
ub2 val;
|
12
|
-
|
13
|
-
chker3(OCIAttrGet(base->hp.ptr, base->type, &val, NULL, attrtype, oci8_errhp),
|
14
|
-
base, stmtp);
|
15
|
-
return INT2FIX(val);
|
16
|
-
}
|
17
|
-
|
18
9
|
#define MAX_ROWID_LEN 128
|
19
10
|
|
20
11
|
typedef struct {
|
data/ext/oci8/bind.c
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
/*
|
3
3
|
* bind.c
|
4
4
|
*
|
5
|
-
* Copyright (C) 2002-
|
5
|
+
* Copyright (C) 2002-2014 Kubo Takehiro <kubo@jiubao.org>
|
6
6
|
*/
|
7
7
|
#include "oci8.h"
|
8
8
|
|
@@ -25,6 +25,23 @@ typedef struct {
|
|
25
25
|
ub1 csfrm;
|
26
26
|
} oci8_bind_string_t;
|
27
27
|
|
28
|
+
const oci8_handle_data_type_t oci8_bind_data_type = {
|
29
|
+
{
|
30
|
+
"OCI8::BindType::Base",
|
31
|
+
{
|
32
|
+
NULL,
|
33
|
+
oci8_handle_cleanup,
|
34
|
+
oci8_handle_size,
|
35
|
+
},
|
36
|
+
&oci8_handle_data_type.rb_data_type, NULL,
|
37
|
+
#ifdef RUBY_TYPED_WB_PROTECTED
|
38
|
+
RUBY_TYPED_WB_PROTECTED,
|
39
|
+
#endif
|
40
|
+
},
|
41
|
+
NULL,
|
42
|
+
0,
|
43
|
+
};
|
44
|
+
|
28
45
|
/*
|
29
46
|
* bind_string
|
30
47
|
*/
|
@@ -104,9 +121,20 @@ static void bind_string_post_bind_hook(oci8_bind_t *obind)
|
|
104
121
|
&obind->base);
|
105
122
|
}
|
106
123
|
|
107
|
-
static const
|
124
|
+
static const oci8_bind_data_type_t bind_string_data_type = {
|
108
125
|
{
|
109
|
-
|
126
|
+
{
|
127
|
+
"OCI8::BindType::String",
|
128
|
+
{
|
129
|
+
NULL,
|
130
|
+
oci8_handle_cleanup,
|
131
|
+
oci8_handle_size,
|
132
|
+
},
|
133
|
+
&oci8_bind_data_type.rb_data_type, NULL,
|
134
|
+
#ifdef RUBY_TYPED_WB_PROTECTED
|
135
|
+
RUBY_TYPED_WB_PROTECTED,
|
136
|
+
#endif
|
137
|
+
},
|
110
138
|
oci8_bind_free,
|
111
139
|
sizeof(oci8_bind_string_t)
|
112
140
|
},
|
@@ -119,6 +147,11 @@ static const oci8_bind_vtable_t bind_string_vtable = {
|
|
119
147
|
bind_string_post_bind_hook,
|
120
148
|
};
|
121
149
|
|
150
|
+
static VALUE bind_string_alloc(VALUE klass)
|
151
|
+
{
|
152
|
+
return oci8_allocate_typeddata(klass, &bind_string_data_type.base);
|
153
|
+
}
|
154
|
+
|
122
155
|
/*
|
123
156
|
* bind_raw
|
124
157
|
*/
|
@@ -141,9 +174,20 @@ static void bind_raw_set(oci8_bind_t *obind, void *data, void **null_structp, VA
|
|
141
174
|
vstr->size = RSTRING_LEN(val);
|
142
175
|
}
|
143
176
|
|
144
|
-
static const
|
177
|
+
static const oci8_bind_data_type_t bind_raw_data_type = {
|
145
178
|
{
|
146
|
-
|
179
|
+
{
|
180
|
+
"OCI8::BindType::RAW",
|
181
|
+
{
|
182
|
+
NULL,
|
183
|
+
oci8_handle_cleanup,
|
184
|
+
oci8_handle_size,
|
185
|
+
},
|
186
|
+
&oci8_bind_data_type.rb_data_type, NULL,
|
187
|
+
#ifdef RUBY_TYPED_WB_PROTECTED
|
188
|
+
RUBY_TYPED_WB_PROTECTED,
|
189
|
+
#endif
|
190
|
+
},
|
147
191
|
oci8_bind_free,
|
148
192
|
sizeof(oci8_bind_string_t)
|
149
193
|
},
|
@@ -155,6 +199,11 @@ static const oci8_bind_vtable_t bind_raw_vtable = {
|
|
155
199
|
SQLT_LVB
|
156
200
|
};
|
157
201
|
|
202
|
+
static VALUE bind_raw_alloc(VALUE klass)
|
203
|
+
{
|
204
|
+
return oci8_allocate_typeddata(klass, &bind_raw_data_type.base);
|
205
|
+
}
|
206
|
+
|
158
207
|
/*
|
159
208
|
* bind_binary_double
|
160
209
|
*/
|
@@ -178,9 +227,20 @@ static void bind_binary_double_init(oci8_bind_t *obind, VALUE svc, VALUE val, VA
|
|
178
227
|
#ifndef SQLT_BDOUBLE
|
179
228
|
#define SQLT_BDOUBLE 22
|
180
229
|
#endif
|
181
|
-
static const
|
230
|
+
static const oci8_bind_data_type_t bind_binary_double_data_type = {
|
182
231
|
{
|
183
|
-
|
232
|
+
{
|
233
|
+
"OCI8::BindType::BinaryDouble",
|
234
|
+
{
|
235
|
+
NULL,
|
236
|
+
oci8_handle_cleanup,
|
237
|
+
oci8_handle_size,
|
238
|
+
},
|
239
|
+
&oci8_bind_data_type.rb_data_type, NULL,
|
240
|
+
#ifdef RUBY_TYPED_WB_PROTECTED
|
241
|
+
RUBY_TYPED_WB_PROTECTED,
|
242
|
+
#endif
|
243
|
+
},
|
184
244
|
oci8_bind_free,
|
185
245
|
sizeof(oci8_bind_t)
|
186
246
|
},
|
@@ -192,10 +252,15 @@ static const oci8_bind_vtable_t bind_binary_double_vtable = {
|
|
192
252
|
SQLT_BDOUBLE
|
193
253
|
};
|
194
254
|
|
255
|
+
static VALUE bind_binary_double_alloc(VALUE klass)
|
256
|
+
{
|
257
|
+
return oci8_allocate_typeddata(klass, &bind_binary_double_data_type.base);
|
258
|
+
}
|
259
|
+
|
195
260
|
static VALUE oci8_bind_get(VALUE self)
|
196
261
|
{
|
197
|
-
oci8_bind_t *obind =
|
198
|
-
const
|
262
|
+
oci8_bind_t *obind = TO_BIND(self);
|
263
|
+
const oci8_bind_data_type_t *data_type = (const oci8_bind_data_type_t *)obind->base.data_type;
|
199
264
|
ub4 idx = obind->curar_idx;
|
200
265
|
void **null_structp = NULL;
|
201
266
|
|
@@ -203,12 +268,12 @@ static VALUE oci8_bind_get(VALUE self)
|
|
203
268
|
if (obind->u.inds[idx] != 0)
|
204
269
|
return Qnil;
|
205
270
|
}
|
206
|
-
return
|
271
|
+
return data_type->get(obind, (void*)((size_t)obind->valuep + obind->alloc_sz * idx), null_structp);
|
207
272
|
}
|
208
273
|
|
209
274
|
static VALUE oci8_bind_get_data(VALUE self)
|
210
275
|
{
|
211
|
-
oci8_bind_t *obind =
|
276
|
+
oci8_bind_t *obind = TO_BIND(self);
|
212
277
|
|
213
278
|
if (obind->maxar_sz == 0) {
|
214
279
|
obind->curar_idx = 0;
|
@@ -227,8 +292,8 @@ static VALUE oci8_bind_get_data(VALUE self)
|
|
227
292
|
|
228
293
|
static VALUE oci8_bind_set(VALUE self, VALUE val)
|
229
294
|
{
|
230
|
-
oci8_bind_t *obind =
|
231
|
-
const
|
295
|
+
oci8_bind_t *obind = TO_BIND(self);
|
296
|
+
const oci8_bind_data_type_t *data_type = (const oci8_bind_data_type_t *)obind->base.data_type;
|
232
297
|
ub4 idx = obind->curar_idx;
|
233
298
|
|
234
299
|
if (NIL_P(val)) {
|
@@ -247,14 +312,14 @@ static VALUE oci8_bind_set(VALUE self, VALUE val)
|
|
247
312
|
null_structp = &obind->u.null_structs[idx];
|
248
313
|
*(OCIInd*)obind->u.null_structs[idx] = 0;
|
249
314
|
}
|
250
|
-
|
315
|
+
data_type->set(obind, (void*)((size_t)obind->valuep + obind->alloc_sz * idx), null_structp, val);
|
251
316
|
}
|
252
317
|
return self;
|
253
318
|
}
|
254
319
|
|
255
320
|
static VALUE oci8_bind_set_data(VALUE self, VALUE val)
|
256
321
|
{
|
257
|
-
oci8_bind_t *obind =
|
322
|
+
oci8_bind_t *obind = TO_BIND(self);
|
258
323
|
|
259
324
|
if (obind->maxar_sz == 0) {
|
260
325
|
obind->curar_idx = 0;
|
@@ -270,7 +335,7 @@ static VALUE oci8_bind_set_data(VALUE self, VALUE val)
|
|
270
335
|
}
|
271
336
|
for (idx = 0; idx < size; idx++) {
|
272
337
|
obind->curar_idx = idx;
|
273
|
-
rb_funcall(self, oci8_id_set, 1,
|
338
|
+
rb_funcall(self, oci8_id_set, 1, RARRAY_AREF(val, idx));
|
274
339
|
}
|
275
340
|
obind->curar_sz = size;
|
276
341
|
}
|
@@ -279,8 +344,8 @@ static VALUE oci8_bind_set_data(VALUE self, VALUE val)
|
|
279
344
|
|
280
345
|
static VALUE oci8_bind_initialize(VALUE self, VALUE svc, VALUE val, VALUE length, VALUE max_array_size)
|
281
346
|
{
|
282
|
-
oci8_bind_t *obind =
|
283
|
-
const
|
347
|
+
oci8_bind_t *obind = TO_BIND(self);
|
348
|
+
const oci8_bind_data_type_t *bind_class = (const oci8_bind_data_type_t *)obind->base.data_type;
|
284
349
|
ub4 cnt = 1;
|
285
350
|
|
286
351
|
obind->tdo = Qnil;
|
@@ -354,16 +419,9 @@ void Init_oci8_bind(VALUE klass)
|
|
354
419
|
rb_define_private_method(cOCI8BindTypeBase, "set_data", oci8_bind_set_data, 1);
|
355
420
|
|
356
421
|
/* register primitive data types. */
|
357
|
-
oci8_define_bind_class("String", &
|
358
|
-
oci8_define_bind_class("RAW", &
|
422
|
+
oci8_define_bind_class("String", &bind_string_data_type, bind_string_alloc);
|
423
|
+
oci8_define_bind_class("RAW", &bind_raw_data_type, bind_raw_alloc);
|
359
424
|
if (oracle_client_version >= ORAVER_10_1) {
|
360
|
-
oci8_define_bind_class("BinaryDouble", &
|
425
|
+
oci8_define_bind_class("BinaryDouble", &bind_binary_double_data_type, bind_binary_double_alloc);
|
361
426
|
}
|
362
427
|
}
|
363
|
-
|
364
|
-
oci8_bind_t *oci8_get_bind(VALUE obj)
|
365
|
-
{
|
366
|
-
oci8_base_t *base;
|
367
|
-
Check_Handle(obj, cOCI8BindTypeBase, base);
|
368
|
-
return (oci8_bind_t *)base;
|
369
|
-
}
|