ruby-oci8 2.2.9 → 2.2.10
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 +4 -4
- data/NEWS +15 -0
- data/README.md +1 -1
- data/dist-files +0 -1
- data/docs/install-on-osx.md +29 -116
- data/ext/oci8/apiwrap.c.tmpl +2 -5
- data/ext/oci8/bind.c +3 -4
- data/ext/oci8/connection_pool.c +3 -3
- data/ext/oci8/lob.c +2 -3
- data/ext/oci8/metadata.c +2 -2
- data/ext/oci8/object.c +5 -3
- data/ext/oci8/oci8.c +5 -5
- data/ext/oci8/oci8lib.c +4 -3
- data/ext/oci8/ocihandle.c +2 -2
- data/ext/oci8/ocinumber.c +9 -9
- data/ext/oci8/oraconf.rb +41 -200
- data/ext/oci8/plthook_osx.c +10 -10
- data/ext/oci8/stmt.c +4 -4
- data/lib/oci8/version.rb +1 -1
- data/lib/oci8.rb +1 -1
- data/ruby-oci8.gemspec +1 -1
- data/test/test_break.rb +6 -5
- data/test/test_oranumber.rb +7 -1
- metadata +4 -6
- data/docs/osx-install-dev-tools.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ca16dcc5691bc79740b2b6e308315d013c3f482f991325f70a129a7cf34de0c
|
4
|
+
data.tar.gz: c953f017dab68ed7c2a3934ec29b7312c401516a04b44d32f53c83b0015988b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c54d89e2b858e9dcd874d3f9351c707443d1171154c1d9145f3ddd0931e3168809fc3e91ef1cbc1dca2e6b4e699e5eb2e5d05a7e320cfb0926359a71ff9b3d9
|
7
|
+
data.tar.gz: 611469d0047283c54b7110090bcd9e45a677c3afaba9f6b1c6c4efbaca8afd3092ee1b871d28149459fa82f52f12e36d71bae6cb99e37be0c5ecb148ae300ead
|
data/NEWS
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# @markup markdown
|
2
2
|
|
3
|
+
2.2.10 (2022-01-12)
|
4
|
+
===================
|
5
|
+
|
6
|
+
- Use `File.exist?` instead of removed `File.exists?` in Ruby 3.2 (GH-242)
|
7
|
+
|
8
|
+
(contributed by Yasuo Honda)
|
9
|
+
|
10
|
+
- Support ruby 3.1 distributed by rubyinstaller.org
|
11
|
+
|
12
|
+
- Remove code for obsolete platforms
|
13
|
+
- Ruby compiled by Borland C++
|
14
|
+
- macOS released several years ago
|
15
|
+
|
16
|
+
- Detect arm64 macOS shared library in oraconf.rb in preparation for Instant Client for Apple Silicon release.
|
17
|
+
|
3
18
|
2.2.9 (2020-12-30)
|
4
19
|
==================
|
5
20
|
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ Ruby-oci8
|
|
2
2
|
=========
|
3
3
|
|
4
4
|
[](http://badge.fury.io/rb/ruby-oci8)
|
5
|
-
[](https://github.com/kubo/ruby-oci8/actions/workflows/tests.yml)
|
6
6
|
|
7
7
|
What is ruby-oci8
|
8
8
|
-----------------
|
data/dist-files
CHANGED
@@ -19,7 +19,6 @@ docs/install-instant-client.md
|
|
19
19
|
docs/install-on-osx.md
|
20
20
|
docs/ldap-auth-and-function-interposition.md
|
21
21
|
docs/number-type-mapping.md
|
22
|
-
docs/osx-install-dev-tools.png
|
23
22
|
docs/platform-specific-issues.md
|
24
23
|
docs/report-installation-issue.md
|
25
24
|
docs/timeout-parameters.md
|
data/docs/install-on-osx.md
CHANGED
@@ -1,133 +1,46 @@
|
|
1
|
-
# @title Install ruby-oci8 on
|
1
|
+
# @title Install ruby-oci8 on macOS
|
2
2
|
|
3
|
-
Install ruby-oci8 on
|
3
|
+
Install ruby-oci8 on macOS
|
4
4
|
=========================
|
5
5
|
|
6
|
-
|
6
|
+
**Note: Ruby-oci8 doesn't run on Apple Silicon because Oracle instant client
|
7
|
+
for Apple Silicon has not been released yet.**
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Install C compiler
|
12
|
-
------------------
|
13
|
-
|
14
|
-
You need to install the command line developer tools or the Xcode.
|
15
|
-
(The latter includes the former.)
|
16
|
-
|
17
|
-
Run `"cc --version"` in a terminal to check whether they are installed.
|
18
|
-
|
19
|
-
If the cc version is printed, the tools are installed.
|
20
|
-
|
21
|
-
If the follwoing dialog is displayed, click its Install button to
|
22
|
-
install the tools.
|
23
|
-
You have no need to install the Xcode to compile ruby-oci8.
|
24
|
-
It requires command line tools, not an IDE such as the Xcode.
|
25
|
-
|
26
|
-

|
9
|
+
Prerequisite
|
10
|
+
------------
|
27
11
|
|
28
|
-
|
29
|
-
please re-run as root via sudo."` is printed, you need to run
|
30
|
-
`"sudo cc --version"`, enter your password, look at the license
|
31
|
-
and type `"agree"`.
|
12
|
+
* Command line tools for Xcode or Xcode (by executing `xcode-select --install`) or [Xcode]
|
32
13
|
|
33
14
|
Install Oracle Instant Client Packages
|
34
15
|
--------------------------------------
|
35
16
|
|
36
|
-
|
37
|
-
|
38
|
-
Download the following packages from [Oracle Technology Network][]
|
39
|
-
|
40
|
-
* Instant Client Package - Basic (`instantclient-basic-macos.x64-12.1.0.2.0.zip`) or Basic Lite (`instantclient-basiclite-macos.x64-12.1.0.2.0.zip`)
|
41
|
-
* Instant Client Package - SDK (`instantclient-sdk-macos.x64-12.1.0.2.0.zip`)
|
42
|
-
* Instant Client Package - SQL*Plus (`instantclient-sqlplus-macos.x64-12.1.0.2.0.zip`) (optionally)
|
43
|
-
|
44
|
-
### Install Oracle Instant Client Packages via Homebrew
|
45
|
-
|
46
|
-
To install `Oracle Instant Client Basic` via [Homebrew][]
|
47
|
-
|
48
|
-
* Copy downloaded zip files to `/Library/Caches/Homebrew`
|
49
|
-
(if the environment variable `HOMEBREW_CACHE`
|
50
|
-
is not set and `$HOME/Library/Caches/Homebrew` doesn't exist.)
|
51
|
-
|
52
|
-
* Run the followining commands:
|
53
|
-
|
54
|
-
brew tap InstantClientTap/instantclient
|
55
|
-
brew install instantclient-basic
|
56
|
-
brew install instantclient-sdk
|
57
|
-
brew install instantclient-sqlplus # (optionally)
|
58
|
-
|
59
|
-
* Set the environment variable `OCI_DIR` while performing the following installation steps
|
60
|
-
if Homebrew is installed outside `/usr/local`.
|
61
|
-
|
62
|
-
export OCI_DIR=$(brew --prefix)/lib
|
63
|
-
|
64
|
-
To install `Oracle Instant Client Basic Lite` via [Homebrew][]
|
65
|
-
|
66
|
-
* Copy downloaded zip files to `/Library/Caches/Homebrew`
|
67
|
-
(if the environment variable `HOMEBREW_CACHE`
|
68
|
-
is not set and `$HOME/Library/Caches/Homebrew` doesn't exist.)
|
69
|
-
|
70
|
-
* Run the followining commands:
|
71
|
-
|
72
|
-
brew tap InstantClientTap/instantclient
|
73
|
-
brew install instantclient-basiclite
|
74
|
-
brew install instantclient-sdk
|
75
|
-
brew install instantclient-sqlplus --with-basiclite # (optionally)
|
76
|
-
|
77
|
-
* Set the environment variable `OCI_DIR` while performing the following installation steps
|
78
|
-
if Homebrew is installed outside `/usr/local`.
|
79
|
-
|
80
|
-
export OCI_DIR=$(brew --prefix)/lib
|
81
|
-
|
82
|
-
### Install Oracle Instant Client Manually
|
83
|
-
|
84
|
-
If you don't use [Homebrew][], do the following:
|
85
|
-
|
86
|
-
Unzip the packages as follows:
|
87
|
-
|
88
|
-
mkdir -p /opt/oracle
|
89
|
-
cd /opt/oracle
|
90
|
-
|
91
|
-
Copy downloaded files to /opt/oracle before running the following commands.
|
92
|
-
|
93
|
-
unzip instantclient-basic-macos.x64-12.1.0.2.0.zip
|
94
|
-
unzip instantclient-sdk-macos.x64-12.1.0.2.0.zip
|
95
|
-
unzip instantclient-sqlplus-macos.x64-12.1.0.2.0.zip
|
96
|
-
|
97
|
-
Make a symbolic link to link the library.
|
98
|
-
|
99
|
-
cd /opt/oracle/instantclient_12_1
|
100
|
-
ln -s libclntsh.dylib.12.1 libclntsh.dylib
|
101
|
-
|
102
|
-
Set the environment variable OCI_DIR while performing the following installation steps.
|
103
|
-
|
104
|
-
export OCI_DIR=/opt/oracle/instantclient_12_1
|
105
|
-
|
106
|
-
Installation
|
107
|
-
------------
|
108
|
-
|
109
|
-
If you get a problem in the following steps, look at {file:docs/report-installation-issue.md}.
|
110
|
-
|
111
|
-
### gem package
|
112
|
-
|
113
|
-
Run the following command.
|
17
|
+
If you have installed [Homebrew], use the following command:
|
114
18
|
|
115
|
-
|
19
|
+
```shell
|
20
|
+
$ brew tap InstantClientTap/instantclient
|
21
|
+
$ brew install instantclient-basic # or instantclient-basiclite
|
22
|
+
$ brew install instantclient-sdk
|
23
|
+
$ brew install instantclient-sqlplus # (optionally)
|
24
|
+
```
|
116
25
|
|
117
|
-
|
26
|
+
Otherwise, look at this [page][OTN] and set the environment variable
|
27
|
+
`OCI_DIR` to point the the directory where instant client is installed.
|
28
|
+
Ruby-oci8 installation script checks the directory.
|
118
29
|
|
119
|
-
|
30
|
+
```shell
|
31
|
+
export OCI_DIR=$HOME/Downloads/instantclient_19_8 # for example
|
32
|
+
```
|
120
33
|
|
121
|
-
|
34
|
+
Install ruby-oci8
|
35
|
+
-----------------
|
122
36
|
|
123
|
-
|
37
|
+
Note that `/usr/bin/ruby` isn't available. You need to use [`rbenv`] or so.
|
124
38
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
make install
|
39
|
+
```shell
|
40
|
+
$ gem install ruby-oci8
|
41
|
+
```
|
129
42
|
|
130
|
-
[download page]: https://bintray.com/kubo/generic/ruby-oci8
|
131
43
|
[Homebrew]: http://brew.sh/
|
132
|
-
[
|
133
|
-
[
|
44
|
+
[OTN]: https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html#ic_osx_inst
|
45
|
+
[Xcode]: https://apps.apple.com/us/app/xcode/id497799835
|
46
|
+
[`rbenv`]: https://github.com/rbenv/rbenv
|
data/ext/oci8/apiwrap.c.tmpl
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
%>
|
5
5
|
#define API_WRAP_C 1
|
6
6
|
#include "apiwrap.h"
|
7
|
-
#define BLOCKING_FUNCTION_EPILOGUE(svcctx) do { (svcctx)->executing_thread = Qnil; } while (0)
|
8
7
|
|
9
8
|
<%
|
10
9
|
prev_name = ''
|
@@ -59,11 +58,9 @@ static void *oci8_<%=f.name%>_cb(void *user_data)
|
|
59
58
|
%> data->rv = <%=f.name%>(<%= f.args.collect do |a| 'data->' + a.name; end.join(', ') %>);
|
60
59
|
<% end %>
|
61
60
|
<% if f.ret == 'sword'
|
62
|
-
%>
|
63
|
-
return (void*)(VALUE)data->rv;
|
61
|
+
%> return (void*)(VALUE)data->rv;
|
64
62
|
<% else
|
65
|
-
%>
|
66
|
-
return NULL;
|
63
|
+
%> return NULL;
|
67
64
|
<% end %>
|
68
65
|
}
|
69
66
|
#else
|
data/ext/oci8/bind.c
CHANGED
@@ -85,7 +85,7 @@ static void bind_string_set(oci8_bind_t *obind, void *data, void **null_structp,
|
|
85
85
|
rb_raise(rb_eArgError, "too long String to set. (%ld for %d)", RSTRING_LEN(val), obs->bytelen);
|
86
86
|
}
|
87
87
|
memcpy(vstr->buf, RSTRING_PTR(val), RSTRING_LEN(val));
|
88
|
-
vstr->size =
|
88
|
+
vstr->size = RSTRING_LENINT(val);
|
89
89
|
}
|
90
90
|
|
91
91
|
static void bind_string_init(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE param)
|
@@ -195,7 +195,7 @@ static void bind_raw_set(oci8_bind_t *obind, void *data, void **null_structp, VA
|
|
195
195
|
rb_raise(rb_eArgError, "too long String to set. (%ld for %d)", RSTRING_LEN(val), obs->bytelen);
|
196
196
|
}
|
197
197
|
memcpy(vstr->buf, RSTRING_PTR(val), RSTRING_LEN(val));
|
198
|
-
vstr->size =
|
198
|
+
vstr->size = RSTRING_LENINT(val);
|
199
199
|
}
|
200
200
|
|
201
201
|
static const oci8_bind_data_type_t bind_raw_data_type = {
|
@@ -470,7 +470,6 @@ static VALUE bind_long_get(oci8_bind_t *obind, void *data, void *null_struct)
|
|
470
470
|
str = rb_str_conv_enc(str, oci8_encoding, enc);
|
471
471
|
}
|
472
472
|
}
|
473
|
-
OBJ_TAINT(str);
|
474
473
|
return str;
|
475
474
|
}
|
476
475
|
|
@@ -701,7 +700,7 @@ static VALUE oci8_bind_set_data(VALUE self, VALUE val)
|
|
701
700
|
ub4 idx;
|
702
701
|
Check_Type(val, T_ARRAY);
|
703
702
|
|
704
|
-
size =
|
703
|
+
size = RARRAY_LENINT(val);
|
705
704
|
if (size > obind->maxar_sz) {
|
706
705
|
rb_raise(rb_eRuntimeError, "over the max array size");
|
707
706
|
}
|
data/ext/oci8/connection_pool.c
CHANGED
@@ -144,13 +144,13 @@ static VALUE oci8_cpool_initialize(int argc, VALUE *argv, VALUE self)
|
|
144
144
|
chker2(OCIConnectionPoolCreate(oci8_envhp, oci8_errhp, cpool->base.hp.poolhp,
|
145
145
|
&pool_name, &pool_name_len,
|
146
146
|
NIL_P(dbname) ? NULL : RSTRING_ORATEXT(dbname),
|
147
|
-
NIL_P(dbname) ? 0 :
|
147
|
+
NIL_P(dbname) ? 0 : RSTRING_LENINT(dbname),
|
148
148
|
FIX2UINT(conn_min), FIX2UINT(conn_max),
|
149
149
|
FIX2UINT(conn_incr),
|
150
150
|
NIL_P(username) ? NULL : RSTRING_ORATEXT(username),
|
151
|
-
NIL_P(username) ? 0 :
|
151
|
+
NIL_P(username) ? 0 : RSTRING_LENINT(username),
|
152
152
|
NIL_P(password) ? NULL : RSTRING_ORATEXT(password),
|
153
|
-
NIL_P(password) ? 0 :
|
153
|
+
NIL_P(password) ? 0 : RSTRING_LENINT(password),
|
154
154
|
OCI_DEFAULT),
|
155
155
|
&cpool->base);
|
156
156
|
RB_OBJ_WRITE(cpool->base.self, &cpool->pool_name, rb_str_new(TO_CHARPTR(pool_name), pool_name_len));
|
data/ext/oci8/lob.c
CHANGED
@@ -719,7 +719,6 @@ read_more_data:
|
|
719
719
|
default:
|
720
720
|
v = rb_ary_join(v, Qnil);
|
721
721
|
}
|
722
|
-
OBJ_TAINT(v);
|
723
722
|
if (lob->lobtype == OCI_TEMP_CLOB) {
|
724
723
|
/* set encoding */
|
725
724
|
rb_enc_associate(v, oci8_encoding);
|
@@ -766,10 +765,10 @@ static VALUE oci8_lob_write(VALUE self, VALUE data)
|
|
766
765
|
RB_GC_GUARD(str);
|
767
766
|
if (lob->lobtype == OCI_TEMP_CLOB) {
|
768
767
|
lob->pos += char_amt;
|
769
|
-
return
|
768
|
+
return ULL2NUM(char_amt);
|
770
769
|
} else {
|
771
770
|
lob->pos += byte_amt;
|
772
|
-
return
|
771
|
+
return ULL2NUM(byte_amt);
|
773
772
|
}
|
774
773
|
}
|
775
774
|
|
data/ext/oci8/metadata.c
CHANGED
@@ -195,7 +195,7 @@ VALUE oci8_do_describe(VALUE self, void *objptr, ub4 objlen, ub1 objtype, VALUE
|
|
195
195
|
static VALUE oci8_describe(VALUE self, VALUE name, VALUE klass, VALUE check_public)
|
196
196
|
{
|
197
197
|
char *str;
|
198
|
-
|
198
|
+
int idx, len;
|
199
199
|
VALUE metadata;
|
200
200
|
VALUE obj_link = Qnil;
|
201
201
|
|
@@ -204,7 +204,7 @@ static VALUE oci8_describe(VALUE self, VALUE name, VALUE klass, VALUE check_publ
|
|
204
204
|
rb_raise(rb_eArgError, "empty string is set.");
|
205
205
|
}
|
206
206
|
str = RSTRING_PTR(name);
|
207
|
-
len =
|
207
|
+
len = RSTRING_LENINT(name);
|
208
208
|
for (idx = 0; idx < len; idx++) {
|
209
209
|
if (str[idx] == '@') {
|
210
210
|
obj_link = rb_enc_str_new(str + idx + 1, len - idx - 1, oci8_encoding);
|
data/ext/oci8/object.c
CHANGED
@@ -485,7 +485,7 @@ static VALUE set_coll_element_func(set_coll_element_cb_data_t *cb_data)
|
|
485
485
|
|
486
486
|
chkerr(OCICollSize(oci8_envhp, oci8_errhp, coll, &size));
|
487
487
|
if (RARRAY_LEN(val) < size) {
|
488
|
-
chkerr(OCICollTrim(oci8_envhp, oci8_errhp, size - RARRAY_LEN(val), coll));
|
488
|
+
chkerr(OCICollTrim(oci8_envhp, oci8_errhp, (sb4)(size - RARRAY_LEN(val)), coll));
|
489
489
|
}
|
490
490
|
for (idx = 0; idx < RARRAY_LEN(val); idx++) {
|
491
491
|
switch (FIX2INT(datatype)) {
|
@@ -559,13 +559,13 @@ static void set_attribute(VALUE self, VALUE datatype, VALUE typeinfo, void *data
|
|
559
559
|
case ATTR_STRING:
|
560
560
|
OCI8StringValue(val);
|
561
561
|
chkerr(OCIStringAssignText(oci8_envhp, oci8_errhp,
|
562
|
-
RSTRING_ORATEXT(val),
|
562
|
+
RSTRING_ORATEXT(val), RSTRING_LENINT(val),
|
563
563
|
(OCIString **)data));
|
564
564
|
break;
|
565
565
|
case ATTR_RAW:
|
566
566
|
StringValue(val);
|
567
567
|
chkerr(OCIRawAssignBytes(oci8_envhp, oci8_errhp,
|
568
|
-
RSTRING_ORATEXT(val),
|
568
|
+
RSTRING_ORATEXT(val), RSTRING_LENINT(val),
|
569
569
|
(OCIRaw **)data));
|
570
570
|
break;
|
571
571
|
case ATTR_OCINUMBER:
|
@@ -729,6 +729,8 @@ static VALUE bind_named_type_get(oci8_bind_t *obind, void *data, void *null_stru
|
|
729
729
|
return bnt->obj[idx];
|
730
730
|
}
|
731
731
|
|
732
|
+
NORETURN(static void bind_named_type_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val));
|
733
|
+
|
732
734
|
static void bind_named_type_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
|
733
735
|
{
|
734
736
|
rb_raise(rb_eRuntimeError, "not supported");
|
data/ext/oci8/oci8.c
CHANGED
@@ -556,7 +556,7 @@ static VALUE oci8_server_attach(VALUE self, VALUE dbname, VALUE attach_mode)
|
|
556
556
|
/* attach to the server */
|
557
557
|
chker2(OCIServerAttach_nb(svcctx, svcctx->srvhp, oci8_errhp,
|
558
558
|
NIL_P(dbname) ? NULL : RSTRING_ORATEXT(dbname),
|
559
|
-
NIL_P(dbname) ? 0 :
|
559
|
+
NIL_P(dbname) ? 0 : RSTRING_LENINT(dbname),
|
560
560
|
mode),
|
561
561
|
&svcctx->base);
|
562
562
|
chker2(OCIAttrSet(svcctx->base.hp.ptr, OCI_HTYPE_SVCCTX,
|
@@ -864,7 +864,7 @@ static VALUE oci8_set_client_identifier(VALUE self, VALUE val)
|
|
864
864
|
if (!NIL_P(val)) {
|
865
865
|
OCI8SafeStringValue(val);
|
866
866
|
ptr = RSTRING_PTR(val);
|
867
|
-
size =
|
867
|
+
size = RSTRING_LENINT(val);
|
868
868
|
} else {
|
869
869
|
ptr = "";
|
870
870
|
size = 0;
|
@@ -899,7 +899,7 @@ static VALUE oci8_set_module(VALUE self, VALUE val)
|
|
899
899
|
if (!NIL_P(val)) {
|
900
900
|
OCI8SafeStringValue(val);
|
901
901
|
ptr = RSTRING_PTR(val);
|
902
|
-
size =
|
902
|
+
size = RSTRING_LENINT(val);
|
903
903
|
} else {
|
904
904
|
ptr = "";
|
905
905
|
size = 0;
|
@@ -933,7 +933,7 @@ static VALUE oci8_set_action(VALUE self, VALUE val)
|
|
933
933
|
if (!NIL_P(val)) {
|
934
934
|
OCI8SafeStringValue(val);
|
935
935
|
ptr = RSTRING_PTR(val);
|
936
|
-
size =
|
936
|
+
size = RSTRING_LENINT(val);
|
937
937
|
} else {
|
938
938
|
ptr = "";
|
939
939
|
size = 0;
|
@@ -964,7 +964,7 @@ static VALUE oci8_set_client_info(VALUE self, VALUE val)
|
|
964
964
|
if (!NIL_P(val)) {
|
965
965
|
OCI8SafeStringValue(val);
|
966
966
|
ptr = RSTRING_PTR(val);
|
967
|
-
size =
|
967
|
+
size = RSTRING_LENINT(val);
|
968
968
|
} else {
|
969
969
|
ptr = "";
|
970
970
|
size = 0;
|
data/ext/oci8/oci8lib.c
CHANGED
@@ -71,7 +71,7 @@ static VALUE bind_base_alloc(VALUE klass)
|
|
71
71
|
rb_raise(rb_eNameError, "private method `new' called for %s:Class", rb_class2name(klass));
|
72
72
|
}
|
73
73
|
|
74
|
-
#if defined(HAVE_PLTHOOK) && !defined(WIN32) && !defined(__CYGWIN__)
|
74
|
+
#if defined(HAVE_PLTHOOK) && !defined(WIN32) && !defined(__CYGWIN__) && !defined(TRUFFLERUBY)
|
75
75
|
static const char *find_libclntsh(void *handle)
|
76
76
|
{
|
77
77
|
void *symaddr = dlsym(handle, "OCIEnvCreate");
|
@@ -226,7 +226,7 @@ Init_oci8lib()
|
|
226
226
|
oracle_client_version = ORAVERNUM(major, minor, update, patch, port_update);
|
227
227
|
}
|
228
228
|
#endif
|
229
|
-
#if defined(HAVE_PLTHOOK) && !defined(WIN32) && !defined(__CYGWIN__)
|
229
|
+
#if defined(HAVE_PLTHOOK) && !defined(WIN32) && !defined(__CYGWIN__) && !defined(TRUFFLERUBY)
|
230
230
|
rebind_internal_symbols();
|
231
231
|
#endif
|
232
232
|
|
@@ -461,6 +461,7 @@ sword oci8_call_without_gvl(oci8_svcctx_t *svcctx, void *(*func)(void *), void *
|
|
461
461
|
parg.func = func;
|
462
462
|
parg.data = data;
|
463
463
|
rv = (sword)rb_protect(protected_call, (VALUE)&parg, &state);
|
464
|
+
RB_OBJ_WRITE(svcctx->base.self, &svcctx->executing_thread, Qnil);
|
464
465
|
if (state) {
|
465
466
|
rb_jump_tag(state);
|
466
467
|
}
|
@@ -510,7 +511,7 @@ static VALUE exec_sql(VALUE varg)
|
|
510
511
|
sword rv;
|
511
512
|
|
512
513
|
chker2(OCIStmtPrepare2(arg->svcctx->base.hp.svc, &arg->stmtp, oci8_errhp,
|
513
|
-
(text*)arg->sql_text, strlen(arg->sql_text), NULL, 0,
|
514
|
+
(text*)arg->sql_text, (ub4)strlen(arg->sql_text), NULL, 0,
|
514
515
|
OCI_NTV_SYNTAX, OCI_DEFAULT),
|
515
516
|
&arg->svcctx->base);
|
516
517
|
for (pos = 0; pos < arg->num_define_vars; pos++) {
|
data/ext/oci8/ocihandle.c
CHANGED
@@ -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
|
|
@@ -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
|
|
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
|
}
|
@@ -249,7 +249,7 @@ static int set_oci_number_from_num(OCINumber *result, VALUE num, int force, OCIE
|
|
249
249
|
if (TYPE(ary[1]) != T_STRING) {
|
250
250
|
goto is_not_big_decimal;
|
251
251
|
}
|
252
|
-
digits_len =
|
252
|
+
digits_len = RSTRING_LENINT(ary[1]);
|
253
253
|
set_oci_number_from_str(&digits, ary[1], Qnil, Qnil, errhp);
|
254
254
|
/* check base */
|
255
255
|
if (TYPE(ary[2]) != T_FIXNUM || FIX2LONG(ary[2]) != 10) {
|
@@ -365,7 +365,7 @@ OCINumber *oci8_dbl_to_onum(OCINumber *result, double dbl, OCIError *errhp)
|
|
365
365
|
sword rv;
|
366
366
|
|
367
367
|
str = rb_obj_as_string(rb_float_new(dbl));
|
368
|
-
rv = oranumber_from_str(result, RSTRING_PTR(str),
|
368
|
+
rv = oranumber_from_str(result, RSTRING_PTR(str), RSTRING_LENINT(str));
|
369
369
|
if (rv != 0) {
|
370
370
|
oci8_raise_by_msgno(rv, NULL);
|
371
371
|
}
|
@@ -1309,14 +1309,14 @@ static VALUE onum_to_char(int argc, VALUE *argv, VALUE self)
|
|
1309
1309
|
}
|
1310
1310
|
StringValue(fmt);
|
1311
1311
|
fmt_ptr = RSTRING_ORATEXT(fmt);
|
1312
|
-
fmt_len =
|
1312
|
+
fmt_len = RSTRING_LENINT(fmt);
|
1313
1313
|
if (NIL_P(nls_params)) {
|
1314
1314
|
nls_params_ptr = NULL;
|
1315
1315
|
nls_params_len = 0;
|
1316
1316
|
} else {
|
1317
1317
|
StringValue(nls_params);
|
1318
1318
|
nls_params_ptr = RSTRING_ORATEXT(nls_params);
|
1319
|
-
nls_params_len =
|
1319
|
+
nls_params_len = RSTRING_LENINT(nls_params);
|
1320
1320
|
}
|
1321
1321
|
rv = OCINumberToText(errhp, _NUMBER(self),
|
1322
1322
|
fmt_ptr, fmt_len, nls_params_ptr, nls_params_len,
|
@@ -1437,7 +1437,7 @@ static VALUE onum_to_d_real(OCINumber *num, OCIError *errhp)
|
|
1437
1437
|
rb_require("bigdecimal");
|
1438
1438
|
cBigDecimal = rb_const_get(rb_cObject, id_BigDecimal);
|
1439
1439
|
}
|
1440
|
-
chkerr(OCINumberToText(errhp, num, (const oratext *)fmt, strlen(fmt),
|
1440
|
+
chkerr(OCINumberToText(errhp, num, (const oratext *)fmt, (ub4)strlen(fmt),
|
1441
1441
|
NULL, 0, &buf_size, TO_ORATEXT(buf)));
|
1442
1442
|
return rb_funcall(rb_cObject, id_BigDecimal, 1, rb_usascii_str_new(buf, buf_size));
|
1443
1443
|
}
|
data/ext/oci8/oraconf.rb
CHANGED
@@ -4,7 +4,7 @@ require 'mkmf'
|
|
4
4
|
# compatibility for ruby-1.9
|
5
5
|
RbConfig = Config unless defined? RbConfig
|
6
6
|
|
7
|
-
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|
|
7
|
+
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|mingw/
|
8
8
|
# Windows
|
9
9
|
require 'win32/registry'
|
10
10
|
module Registry
|
@@ -43,6 +43,10 @@ class MiniSOReader
|
|
43
43
|
attr_reader :endian
|
44
44
|
attr_reader :bits
|
45
45
|
|
46
|
+
MACH_O_CPU_TYPE_I386 = 7
|
47
|
+
MACH_O_CPU_TYPE_X86_64 = 7 + 0x01000000
|
48
|
+
MACH_O_CPU_TYPE_ARM64 = 12 + 0x01000000
|
49
|
+
|
46
50
|
def initialize(filename)
|
47
51
|
f = open(filename, 'rb')
|
48
52
|
begin
|
@@ -56,9 +60,6 @@ class MiniSOReader
|
|
56
60
|
when "\x02\x10"
|
57
61
|
# HP-UX PA-RISC1.1
|
58
62
|
read_parisc(f)
|
59
|
-
when "\xfe\xed"
|
60
|
-
# Big-endian Mach-O File
|
61
|
-
read_mach_o_be(f)
|
62
63
|
when "\xce\xfa"
|
63
64
|
# 32-bit Little-endian Mach-O File
|
64
65
|
read_mach_o_le(f, 32)
|
@@ -67,10 +68,10 @@ class MiniSOReader
|
|
67
68
|
read_mach_o_le(f, 64)
|
68
69
|
when "\xca\xfe"
|
69
70
|
# Universal binary
|
70
|
-
|
71
|
+
read_mach_o_universal(f)
|
71
72
|
else
|
72
73
|
# AIX and Tru64
|
73
|
-
raise format("unknown file header: %02x %02x", file_header[0].
|
74
|
+
raise format("unknown file header: %02x %02x (%s)", file_header[0].ord, file_header[1].ord, filename)
|
74
75
|
end
|
75
76
|
ensure
|
76
77
|
f.close
|
@@ -174,22 +175,6 @@ class MiniSOReader
|
|
174
175
|
@cpu = :parisc
|
175
176
|
end
|
176
177
|
|
177
|
-
# Big-endian Mach-O File
|
178
|
-
def read_mach_o_be(f)
|
179
|
-
@file_format = :mach_o
|
180
|
-
@endian = :big
|
181
|
-
case f.read(2)
|
182
|
-
when "\xfa\xce" # feedface
|
183
|
-
@cpu = :ppc
|
184
|
-
@bits = 32
|
185
|
-
when "\xfa\xcf" # feedfacf
|
186
|
-
@cpu = :ppc64
|
187
|
-
@bits = 64
|
188
|
-
else
|
189
|
-
raise "unknown file format"
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
178
|
def read_mach_o_le(f, bits)
|
194
179
|
@file_format = :mach_o
|
195
180
|
@endian = :little
|
@@ -199,12 +184,20 @@ class MiniSOReader
|
|
199
184
|
@cpu = :i386
|
200
185
|
@bits = 32
|
201
186
|
when 64
|
202
|
-
|
187
|
+
cputype = f.read(4).unpack('V')[0]
|
188
|
+
case cputype
|
189
|
+
when MACH_O_CPU_TYPE_X86_64
|
190
|
+
@cpu = :x86_64
|
191
|
+
when MACH_O_CPU_TYPE_ARM64
|
192
|
+
@cpu = :arm64
|
193
|
+
else
|
194
|
+
raise "unknown mach-o cpu type: #{cputype}"
|
195
|
+
end
|
203
196
|
@bits = 64
|
204
197
|
end
|
205
198
|
end
|
206
199
|
|
207
|
-
def
|
200
|
+
def read_mach_o_universal(f)
|
208
201
|
raise 'unknown file format' if f.read(2) != "\xba\xbe" # cafebabe
|
209
202
|
@file_format = :universal
|
210
203
|
nfat_arch = f.read(4).unpack('N')[0]
|
@@ -213,21 +206,17 @@ class MiniSOReader
|
|
213
206
|
@bits = []
|
214
207
|
nfat_arch.times do
|
215
208
|
case cputype = f.read(4).unpack('N')[0]
|
216
|
-
when
|
209
|
+
when MACH_O_CPU_TYPE_I386
|
217
210
|
@cpu << :i386
|
218
211
|
@endian << :little
|
219
212
|
@bits << 32
|
220
|
-
when
|
213
|
+
when MACH_O_CPU_TYPE_X86_64
|
221
214
|
@cpu << :x86_64
|
222
215
|
@endian << :little
|
223
216
|
@bits << 64
|
224
|
-
when
|
225
|
-
@cpu << :
|
226
|
-
@endian << :
|
227
|
-
@bits << 32
|
228
|
-
when 18 + 0x01000000
|
229
|
-
@cpu << :ppc64
|
230
|
-
@endian << :big
|
217
|
+
when MACH_O_CPU_TYPE_ARM64
|
218
|
+
@cpu << :arm64
|
219
|
+
@endian << :little
|
231
220
|
@bits << 64
|
232
221
|
else
|
233
222
|
raise "Unknown mach-o cputype: #{cputype}"
|
@@ -383,7 +372,7 @@ EOS
|
|
383
372
|
is_32bit = size_of_pointer == 4
|
384
373
|
is_big_endian = "\x01\x02".unpack('s')[0] == 0x0102
|
385
374
|
case RUBY_PLATFORM
|
386
|
-
when /mswin32|mswin64|cygwin|
|
375
|
+
when /mswin32|mswin64|cygwin|mingw/
|
387
376
|
oci_basename = 'oci'
|
388
377
|
oci_glob_postfix = ''
|
389
378
|
nls_data_basename = ['oraociei*', 'oraociicus*']
|
@@ -426,20 +415,13 @@ EOS
|
|
426
415
|
end
|
427
416
|
so_ext = 'sl'
|
428
417
|
when /darwin/
|
429
|
-
@@ld_envs = %w[
|
418
|
+
@@ld_envs = %w[OCI_DIR]
|
430
419
|
so_ext = 'dylib'
|
431
420
|
if is_32bit
|
432
|
-
|
433
|
-
this_cpu = :ppc # 32-bit big-endian
|
434
|
-
else
|
435
|
-
this_cpu = :i386 # 32-bit little-endian
|
436
|
-
end
|
421
|
+
this_cpu = :i386 # 32-bit little-endian
|
437
422
|
else
|
438
|
-
|
439
|
-
|
440
|
-
else
|
441
|
-
this_cpu = :x86_64 # 64-bit little-endian
|
442
|
-
end
|
423
|
+
require 'etc'
|
424
|
+
this_cpu = Etc.uname[:machine].to_sym
|
443
425
|
end
|
444
426
|
check_proc = Proc.new do |file|
|
445
427
|
so = MiniSOReader.new(file)
|
@@ -513,49 +495,6 @@ EOS
|
|
513
495
|
end
|
514
496
|
end
|
515
497
|
when /darwin/
|
516
|
-
fallback_path = ENV['DYLD_FALLBACK_LIBRARY_PATH']
|
517
|
-
if fallback_path.nil?
|
518
|
-
puts " DYLD_FALLBACK_LIBRARY_PATH is not set."
|
519
|
-
else
|
520
|
-
puts " checking DYLD_FALLBACK_LIBRARY_PATH..."
|
521
|
-
ld_path, file = check_lib_in_path(fallback_path, glob_name, check_proc)
|
522
|
-
end
|
523
|
-
if ld_path.nil?
|
524
|
-
puts " checking OCI_DIR..."
|
525
|
-
ld_path, file = check_lib_in_path(ENV['OCI_DIR'], glob_name, check_proc)
|
526
|
-
if ld_path
|
527
|
-
puts " checking dependent shared libraries in #{file}..."
|
528
|
-
open("|otool -L #{file}") do |f|
|
529
|
-
f.gets # discard the first line
|
530
|
-
while line = f.gets
|
531
|
-
line =~ /^\s+(\S+)/
|
532
|
-
libname = $1
|
533
|
-
case libname
|
534
|
-
when /^@rpath\/libclntsh\.dylib/, /^@rpath\/libnnz\d\d\.dylib/, /^@loader_path\/libnnz\d\d\.dylib/
|
535
|
-
# No need to check the real path.
|
536
|
-
# The current instant client doesn't use @rpath or @loader_path.
|
537
|
-
when /\/libclntsh\.dylib/, /\/libnnz\d\d.dylib/
|
538
|
-
raise <<EOS unless File.exists?(libname)
|
539
|
-
The output of "otool -L #{file}" is:
|
540
|
-
| #{IO.readlines("|otool -L #{file}").join(' | ')}
|
541
|
-
Ruby-oci8 doesn't work without DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH
|
542
|
-
because the dependent file "#{libname}" doesn't exist.
|
543
|
-
|
544
|
-
If you need to use ruby-oci8 without DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH,
|
545
|
-
download "fix_oralib.rb" in https://github.com/kubo/fix_oralib_osx
|
546
|
-
and execute it in the directory "#{File.dirname(file)}" as follows to fix the path.
|
547
|
-
|
548
|
-
cd #{File.dirname(file)}
|
549
|
-
curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb
|
550
|
-
ruby fix_oralib.rb
|
551
|
-
|
552
|
-
Note: DYLD_* environment variables are unavailable for security reasons on OS X 10.11 El Capitan.
|
553
|
-
EOS
|
554
|
-
end
|
555
|
-
end
|
556
|
-
end
|
557
|
-
end
|
558
|
-
end
|
559
498
|
if ld_path.nil?
|
560
499
|
fallback_path = ENV['DYLD_FALLBACK_LIBRARY_PATH']
|
561
500
|
if fallback_path.nil?
|
@@ -566,17 +505,8 @@ EOS
|
|
566
505
|
end
|
567
506
|
if ld_path.nil?
|
568
507
|
raise <<EOS
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
If DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH is set, the environment
|
573
|
-
variable must be set at runtime also.
|
574
|
-
|
575
|
-
If OCI_DIR is set, dependent shared library paths are checked. If the checking
|
576
|
-
is passed, ruby-oci8 works without DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH.
|
577
|
-
|
578
|
-
Note: OCI_DIR should be absolute path.
|
579
|
-
Note: DYLD_* environment variables are unavailable for security reasons on OS X 10.11 El Capitan.
|
508
|
+
Oracle instant client is not found.
|
509
|
+
You need to install Oracle instant client.
|
580
510
|
EOS
|
581
511
|
end
|
582
512
|
end
|
@@ -600,8 +530,8 @@ EOS
|
|
600
530
|
paths.split(File::PATH_SEPARATOR).each do |path|
|
601
531
|
next if path.nil? or path == ''
|
602
532
|
print " checking #{path}... "
|
603
|
-
path.gsub!(/\\/, '/') if /mswin32|mswin64|cygwin|
|
604
|
-
files = Dir.glob(File.join(path, glob_name))
|
533
|
+
path.gsub!(/\\/, '/') if /mswin32|mswin64|cygwin|mingw/ =~ RUBY_PLATFORM
|
534
|
+
files = Dir.glob(File.join(path, glob_name)).sort.reverse
|
605
535
|
if files.empty?
|
606
536
|
puts "no"
|
607
537
|
next
|
@@ -675,20 +605,10 @@ EOS
|
|
675
605
|
rubyhdrdir = RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG['archdir']
|
676
606
|
unless File.exist?(rubyhdrdir + '/ruby.h')
|
677
607
|
puts "failed"
|
678
|
-
|
679
|
-
raise <<EOS
|
680
|
-
#{RbConfig::CONFIG['archdir']}/ruby.h doesn't exist.
|
681
|
-
Run the following commands to fix the problem.
|
682
|
-
|
683
|
-
cd #{RbConfig::CONFIG['archdir']}
|
684
|
-
sudo ln -s ../universal-darwin8.0/* ./
|
685
|
-
EOS
|
686
|
-
else
|
687
|
-
raise <<EOS
|
608
|
+
raise <<EOS
|
688
609
|
#{RbConfig::CONFIG['archdir']}/ruby.h doesn't exist.
|
689
610
|
Install the ruby development library.
|
690
611
|
EOS
|
691
|
-
end
|
692
612
|
end
|
693
613
|
puts "ok"
|
694
614
|
$stdout.flush
|
@@ -704,11 +624,11 @@ EOS
|
|
704
624
|
end
|
705
625
|
end
|
706
626
|
|
707
|
-
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|
|
627
|
+
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|mingw/ # when Windows
|
708
628
|
|
709
629
|
def get_libs(lib_dir)
|
710
630
|
case RUBY_PLATFORM
|
711
|
-
when /cygwin
|
631
|
+
when /cygwin/
|
712
632
|
regex = ([nil].pack('P').size == 8) ? / T (OCI\w+)/ : / T _(OCI\w+)/
|
713
633
|
oci_funcs = YAML.load(open(File.dirname(__FILE__) + '/apiwrap.yml')).keys.collect do |func|
|
714
634
|
func =~ /_nb$/ ? $` : func
|
@@ -727,22 +647,6 @@ EOS
|
|
727
647
|
system(command)
|
728
648
|
puts("done")
|
729
649
|
"-L. -lOCI"
|
730
|
-
when /bccwin32/
|
731
|
-
# replace '/' to '\\' because bcc linker misunderstands
|
732
|
-
# 'C:/foo/bar/OCI.LIB' as unknown option.
|
733
|
-
lib = "#{lib_dir}/BORLAND/OCI.LIB"
|
734
|
-
return lib.tr('/', '\\') if File.exist?(lib)
|
735
|
-
raise <<EOS
|
736
|
-
#{lib} does not exist.
|
737
|
-
|
738
|
-
Your Oracle may not support Borland C++.
|
739
|
-
If you want to run this module, run the following command at your own risk.
|
740
|
-
cd #{lib_dir.tr('/', '\\')}
|
741
|
-
mkdir Borland
|
742
|
-
cd Borland
|
743
|
-
coff2omf ..\\MSVC\\OCI.LIB OCI.LIB
|
744
|
-
EOS
|
745
|
-
exit 1
|
746
650
|
else
|
747
651
|
"\"#{lib_dir}/MSVC/OCI.LIB\""
|
748
652
|
end
|
@@ -786,7 +690,7 @@ class OraConfFC < OraConf
|
|
786
690
|
use_lib32 = false
|
787
691
|
end
|
788
692
|
|
789
|
-
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|
|
693
|
+
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|mingw/
|
790
694
|
lib_dir = "#{@oracle_home}/oci/lib"
|
791
695
|
elsif use_lib32
|
792
696
|
lib_dir = "#{@oracle_home}/lib32"
|
@@ -805,7 +709,7 @@ class OraConfFC < OraConf
|
|
805
709
|
print("Get the version of Oracle from SQL*Plus... ")
|
806
710
|
STDOUT.flush
|
807
711
|
version = nil
|
808
|
-
dev_null = RUBY_PLATFORM =~ /mswin32|mswin64|
|
712
|
+
dev_null = RUBY_PLATFORM =~ /mswin32|mswin64|mingw/ ? "nul" : "/dev/null"
|
809
713
|
if File.exist?("#{@oracle_home}/bin/plus80.exe")
|
810
714
|
sqlplus = "plus80.exe"
|
811
715
|
else
|
@@ -830,7 +734,7 @@ class OraConfFC < OraConf
|
|
830
734
|
version
|
831
735
|
end # get_version
|
832
736
|
|
833
|
-
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|
|
737
|
+
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|mingw/ # when Windows
|
834
738
|
|
835
739
|
def is_valid_home?(oracle_home)
|
836
740
|
return false if oracle_home.nil?
|
@@ -912,7 +816,7 @@ EOS
|
|
912
816
|
unless File.exist?("#{@oracle_home}/OCI/INCLUDE/OCI.H")
|
913
817
|
raise "'#{@oracle_home}/OCI/INCLUDE/OCI.H' does not exists. Please install 'Oracle Call Interface'."
|
914
818
|
end
|
915
|
-
if RUBY_PLATFORM =~ /cygwin|
|
819
|
+
if RUBY_PLATFORM =~ /cygwin|mingw/
|
916
820
|
" \"-I#{@oracle_home}/OCI/INCLUDE\" -D_int64=\"long long\""
|
917
821
|
else
|
918
822
|
" \"-I#{@oracle_home}/OCI/INCLUDE\""
|
@@ -996,7 +900,7 @@ class OraConfIC < OraConf
|
|
996
900
|
|
997
901
|
# check lib_dir
|
998
902
|
lib_dirs = lib_dir.split(File::PATH_SEPARATOR)
|
999
|
-
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|
|
903
|
+
if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|mingw/ # when Windows
|
1000
904
|
ocilib = lib_dirs.find do |dir|
|
1001
905
|
File.exist?("#{dir}/sdk/lib/msvc/oci.lib")
|
1002
906
|
end
|
@@ -1061,7 +965,7 @@ EOS
|
|
1061
965
|
# check inc_dir
|
1062
966
|
inc_dirs = inc_dir.split(File::PATH_SEPARATOR)
|
1063
967
|
ociinc = inc_dirs.find do |dir|
|
1064
|
-
File.
|
968
|
+
File.exist?("#{dir}/oci.h")
|
1065
969
|
end
|
1066
970
|
unless ociinc
|
1067
971
|
raise <<EOS
|
@@ -1074,7 +978,7 @@ EOS
|
|
1074
978
|
else
|
1075
979
|
@cflags = " -I#{ociinc}"
|
1076
980
|
end
|
1077
|
-
@cflags += " -D_int64=\"long long\"" if RUBY_PLATFORM =~ /cygwin|
|
981
|
+
@cflags += " -D_int64=\"long long\"" if RUBY_PLATFORM =~ /cygwin|mingw/
|
1078
982
|
|
1079
983
|
# check link
|
1080
984
|
$CFLAGS += @cflags
|
@@ -1086,73 +990,10 @@ EOS
|
|
1086
990
|
else
|
1087
991
|
# 10.1.0 doesn't have OCI_MAJOR_VERSION and OCI_MINOR_VERSION in oci.h.
|
1088
992
|
@version = "1010"
|
1089
|
-
if RUBY_PLATFORM =~ /darwin/ and 1.size == 8 and `sw_vers -productVersion`.chomp == "10.7"
|
1090
|
-
$stderr.print <<EOS
|
1091
|
-
WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN!
|
1092
|
-
|
1093
|
-
64-bit Oracle instant client doesn't work on OS X Lion.
|
1094
|
-
See: https://forums.oracle.com/forums/thread.jspa?threadID=2187558
|
1095
|
-
|
1096
|
-
The compilation is continued because the issue may be fixed in future.
|
1097
|
-
|
1098
|
-
WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN! WARN!
|
1099
|
-
EOS
|
1100
|
-
end
|
1101
993
|
end
|
1102
994
|
return
|
1103
995
|
end
|
1104
996
|
|
1105
|
-
if RUBY_PLATFORM =~ /darwin/
|
1106
|
-
open('mkmf.log', 'r') do |f|
|
1107
|
-
while line = f.gets
|
1108
|
-
if line.include? '/libclntsh.dylib load command 8 unknown cmd field'
|
1109
|
-
raise <<EOS
|
1110
|
-
Intel mac instant client is for Mac OS X 10.5.
|
1111
|
-
It doesn't work on Mac OS X 10.4 or before.
|
1112
|
-
|
1113
|
-
You have three workarounds.
|
1114
|
-
1. Compile ruby as ppc binary and use it with ppc instant client.
|
1115
|
-
2. Use JRuby and JDBC
|
1116
|
-
3. Use a third-party ODBC driver and ruby-odbc.
|
1117
|
-
EOS
|
1118
|
-
# '
|
1119
|
-
end
|
1120
|
-
|
1121
|
-
case line
|
1122
|
-
when /cputype \(\d+, architecture \w+\) does not match cputype \(\d+\) for specified -arch flag: (\w+)/
|
1123
|
-
missing_arch = $1
|
1124
|
-
when /Undefined symbols for architecture (\w+)/
|
1125
|
-
missing_arch = $1
|
1126
|
-
when /missing required architecture (\w+) in file/
|
1127
|
-
missing_arch = $1
|
1128
|
-
end
|
1129
|
-
|
1130
|
-
if missing_arch
|
1131
|
-
if [nil].pack('p').size == 8
|
1132
|
-
my_arch = 'x86_64'
|
1133
|
-
elsif "\x01\x02".unpack('s')[0] == 0x0201
|
1134
|
-
my_arch = 'i386'
|
1135
|
-
else
|
1136
|
-
my_arch = 'ppc'
|
1137
|
-
end
|
1138
|
-
raise <<EOS
|
1139
|
-
Could not compile with Oracle instant client.
|
1140
|
-
You may need to set the environment variable RC_ARCHS or ARCHFLAGS as follows:
|
1141
|
-
|
1142
|
-
RC_ARCHS=#{my_arch}
|
1143
|
-
export RC_ARCHS
|
1144
|
-
or
|
1145
|
-
ARCHFLAGS='-arch #{my_arch}'
|
1146
|
-
export RC_ARCHS
|
1147
|
-
|
1148
|
-
If it does not fix the problem, delete all '-arch #{missing_arch}'
|
1149
|
-
in '#{RbConfig::CONFIG['archdir']}/rbconfig.rb'.
|
1150
|
-
EOS
|
1151
|
-
end
|
1152
|
-
end
|
1153
|
-
end
|
1154
|
-
end
|
1155
|
-
|
1156
997
|
unless ld_path.nil?
|
1157
998
|
raise <<EOS
|
1158
999
|
Could not compile with Oracle instant client.
|
data/ext/oci8/plthook_osx.c
CHANGED
@@ -73,10 +73,10 @@ struct plthook {
|
|
73
73
|
};
|
74
74
|
|
75
75
|
static int plthook_open_real(plthook_t **plthook_out, const struct mach_header *mh);
|
76
|
-
static unsigned int get_bind_addr(plthook_t *plthook, const uint8_t *base, uint32_t lazy_bind_off, uint32_t lazy_bind_size, struct segment_command_ **segments,
|
76
|
+
static unsigned int get_bind_addr(plthook_t *plthook, const uint8_t *base, uint32_t lazy_bind_off, uint32_t lazy_bind_size, struct segment_command_ **segments, ptrdiff_t addrdiff);
|
77
77
|
|
78
78
|
static void set_errmsg(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
|
79
|
-
static void set_bind_addr(unsigned int *idx, plthook_t *plthook, const uint8_t *base, const char *sym_name, int seg_index,
|
79
|
+
static void set_bind_addr(unsigned int *idx, plthook_t *plthook, const uint8_t *base, const char *sym_name, int seg_index, uint64_t seg_offset, struct segment_command_ **segments);
|
80
80
|
|
81
81
|
static uint64_t uleb128(const uint8_t **p)
|
82
82
|
{
|
@@ -148,7 +148,7 @@ int plthook_open_by_handle(plthook_t **plthook_out, void *hndl)
|
|
148
148
|
RTLD_LAZY | RTLD_NOLOAD,
|
149
149
|
RTLD_LAZY | RTLD_NOLOAD | RTLD_FIRST,
|
150
150
|
};
|
151
|
-
|
151
|
+
size_t flag_idx;
|
152
152
|
#define NUM_FLAGS (sizeof(flags) / sizeof(flags[0]))
|
153
153
|
|
154
154
|
if (hndl == NULL) {
|
@@ -196,8 +196,8 @@ static int plthook_open_real(plthook_t **plthook_out, const struct mach_header *
|
|
196
196
|
struct segment_command_ *segments[NUM_SEGMENTS];
|
197
197
|
int segment_idx = 0;
|
198
198
|
unsigned int nbind;
|
199
|
-
|
200
|
-
|
199
|
+
ptrdiff_t addrdiff = 0;
|
200
|
+
uint32_t i;
|
201
201
|
|
202
202
|
memset(segments, 0, sizeof(segments));
|
203
203
|
#ifdef __LP64__
|
@@ -320,14 +320,14 @@ static int plthook_open_real(plthook_t **plthook_out, const struct mach_header *
|
|
320
320
|
return 0;
|
321
321
|
}
|
322
322
|
|
323
|
-
static unsigned int get_bind_addr(plthook_t *plthook, const uint8_t *base, uint32_t lazy_bind_off, uint32_t lazy_bind_size, struct segment_command_ **segments,
|
323
|
+
static unsigned int get_bind_addr(plthook_t *plthook, const uint8_t *base, uint32_t lazy_bind_off, uint32_t lazy_bind_size, struct segment_command_ **segments, ptrdiff_t addrdiff)
|
324
324
|
{
|
325
325
|
const uint8_t *ptr = base + lazy_bind_off + addrdiff;
|
326
326
|
const uint8_t *end = ptr + lazy_bind_size;
|
327
327
|
const char *sym_name;
|
328
328
|
int seg_index = 0;
|
329
329
|
uint64_t seg_offset = 0;
|
330
|
-
|
330
|
+
uint64_t count, skip;
|
331
331
|
unsigned int idx;
|
332
332
|
DEBUG_BIND("get_bind_addr(%p, 0x%x, 0x%x", base, lazy_bind_off, lazy_bind_size);
|
333
333
|
for (idx = 0; segments[idx] != NULL; idx++) {
|
@@ -341,7 +341,7 @@ static unsigned int get_bind_addr(plthook_t *plthook, const uint8_t *base, uint3
|
|
341
341
|
uint8_t imm = *ptr & BIND_IMMEDIATE_MASK;
|
342
342
|
uint64_t ulebval;
|
343
343
|
int64_t slebval;
|
344
|
-
|
344
|
+
uint64_t i;
|
345
345
|
|
346
346
|
DEBUG_BIND("0x%02x: ", *ptr);
|
347
347
|
ptr++;
|
@@ -410,10 +410,10 @@ static unsigned int get_bind_addr(plthook_t *plthook, const uint8_t *base, uint3
|
|
410
410
|
return idx;
|
411
411
|
}
|
412
412
|
|
413
|
-
static void set_bind_addr(unsigned int *idx, plthook_t *plthook, const uint8_t *base, const char *sym_name, int seg_index,
|
413
|
+
static void set_bind_addr(unsigned int *idx, plthook_t *plthook, const uint8_t *base, const char *sym_name, int seg_index, uint64_t seg_offset, struct segment_command_ **segments)
|
414
414
|
{
|
415
415
|
if (plthook != NULL) {
|
416
|
-
|
416
|
+
uint64_t vmaddr = segments[seg_index]->vmaddr;
|
417
417
|
plthook->entries[*idx].name = sym_name;
|
418
418
|
plthook->entries[*idx].addr = (void**)(base + vmaddr + seg_offset);
|
419
419
|
}
|
data/ext/oci8/stmt.c
CHANGED
@@ -78,7 +78,7 @@ static VALUE oci8_stmt_initialize(VALUE self, VALUE svc, VALUE sql)
|
|
78
78
|
if (!NIL_P(sql)) {
|
79
79
|
OCI8SafeStringValue(sql);
|
80
80
|
|
81
|
-
rv = OCIStmtPrepare2(svcctx->base.hp.svc, &stmt->base.hp.stmt, oci8_errhp, RSTRING_ORATEXT(sql),
|
81
|
+
rv = OCIStmtPrepare2(svcctx->base.hp.svc, &stmt->base.hp.stmt, oci8_errhp, RSTRING_ORATEXT(sql), RSTRING_LENINT(sql), NULL, 0, OCI_NTV_SYNTAX, OCI_DEFAULT);
|
82
82
|
if (IS_OCI_ERROR(rv)) {
|
83
83
|
chker2(rv, &svcctx->base);
|
84
84
|
}
|
@@ -178,10 +178,10 @@ static VALUE oci8_bind(VALUE self, VALUE vplaceholder, VALUE vbindobj)
|
|
178
178
|
*/
|
179
179
|
VALUE symval = rb_sym2str(vplaceholder);
|
180
180
|
const char *symname = RSTRING_PTR(symval);
|
181
|
-
|
181
|
+
ub4 len = RSTRING_LENINT(symval);
|
182
182
|
#else
|
183
183
|
const char *symname = rb_id2name(SYM2ID(vplaceholder));
|
184
|
-
|
184
|
+
ub4 len = (ub4)strlen(symname);
|
185
185
|
#endif
|
186
186
|
placeholder_ptr = ALLOCA_N(char, len + 1);
|
187
187
|
placeholder_len = len + 1;
|
@@ -192,7 +192,7 @@ static VALUE oci8_bind(VALUE self, VALUE vplaceholder, VALUE vbindobj)
|
|
192
192
|
} else {
|
193
193
|
OCI8StringValue(vplaceholder);
|
194
194
|
placeholder_ptr = RSTRING_PTR(vplaceholder);
|
195
|
-
placeholder_len =
|
195
|
+
placeholder_len = RSTRING_LENINT(vplaceholder);
|
196
196
|
}
|
197
197
|
obind = TO_BIND(vbindobj); /* 2 */
|
198
198
|
if (obind->base.hp.bnd != NULL) {
|
data/lib/oci8/version.rb
CHANGED
data/lib/oci8.rb
CHANGED
data/ruby-oci8.gemspec
CHANGED
@@ -50,7 +50,7 @@ EOS
|
|
50
50
|
# add map files to analyze a core (minidump) file.
|
51
51
|
so_vers.each do |ver|
|
52
52
|
map_file = 'ext/oci8/oci8lib_#{ver}.map'
|
53
|
-
so_files << map_file if File.
|
53
|
+
so_files << map_file if File.exist? map_file
|
54
54
|
end
|
55
55
|
|
56
56
|
# least version in so_vers
|
data/test/test_break.rb
CHANGED
@@ -99,6 +99,11 @@ class TestBreak < Minitest::Test
|
|
99
99
|
def test_timeout
|
100
100
|
@conn.non_blocking = true
|
101
101
|
start_time = Time.now
|
102
|
+
if server_is_runing_on_windows?
|
103
|
+
end_time = start_time + 5
|
104
|
+
else
|
105
|
+
end_time = start_time + 1
|
106
|
+
end
|
102
107
|
|
103
108
|
if defined? Rubinius and Rubinius::VERSION < "2.0"
|
104
109
|
# Rubinius 1.2.4
|
@@ -112,12 +117,8 @@ class TestBreak < Minitest::Test
|
|
112
117
|
@conn.exec("BEGIN DBMS_LOCK.SLEEP(5); END;")
|
113
118
|
end
|
114
119
|
end
|
115
|
-
if server_is_runing_on_windows?
|
116
|
-
end_time = start_time + 5
|
117
|
-
else
|
118
|
-
end_time = start_time + 1
|
119
|
-
end
|
120
120
|
assert_in_delta(Time.now, end_time, 1)
|
121
|
+
sleep(0.01) # for truffleruby. Is truffleruby too fast?
|
121
122
|
@conn.exec("BEGIN NULL; END;")
|
122
123
|
assert_in_delta(Time.now, end_time, 1)
|
123
124
|
end
|
data/test/test_oranumber.rb
CHANGED
@@ -215,9 +215,15 @@ EOS
|
|
215
215
|
end
|
216
216
|
|
217
217
|
def test_yaml
|
218
|
+
# Use the permitted_classes keyword parameter if it is supported by YAML.load
|
219
|
+
keyword_params = if YAML.method(:load).parameters.any? { |key, value| value == :permitted_symbols }
|
220
|
+
{permitted_classes: [OraNumber]}
|
221
|
+
else
|
222
|
+
{}
|
223
|
+
end
|
218
224
|
(LARGE_RANGE_VALUES + ['~', '-~']).each do |x|
|
219
225
|
n = OraNumber.new(x)
|
220
|
-
assert_equal(n, YAML.load(YAML.dump(n)))
|
226
|
+
assert_equal(n, YAML.load(YAML.dump(n), **keyword_params))
|
221
227
|
end
|
222
228
|
end
|
223
229
|
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-oci8
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kubo Takehiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'ruby-oci8 is a ruby interface for Oracle using OCI8 API. It is available
|
14
14
|
with Oracle 10g or later including Oracle Instant Client.
|
15
15
|
|
16
|
-
'
|
16
|
+
'
|
17
17
|
email: kubo@jiubao.org
|
18
18
|
executables: []
|
19
19
|
extensions:
|
@@ -38,7 +38,6 @@ files:
|
|
38
38
|
- docs/install-on-osx.md
|
39
39
|
- docs/ldap-auth-and-function-interposition.md
|
40
40
|
- docs/number-type-mapping.md
|
41
|
-
- docs/osx-install-dev-tools.png
|
42
41
|
- docs/platform-specific-issues.md
|
43
42
|
- docs/report-installation-issue.md
|
44
43
|
- docs/timeout-parameters.md
|
@@ -153,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
152
|
- !ruby/object:Gem::Version
|
154
153
|
version: '0'
|
155
154
|
requirements: []
|
156
|
-
|
157
|
-
rubygems_version: 2.7.3
|
155
|
+
rubygems_version: 3.1.2
|
158
156
|
signing_key:
|
159
157
|
specification_version: 4
|
160
158
|
summary: Ruby interface for Oracle using OCI8 API
|
Binary file
|