ruby-oci8 2.2.7 → 2.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +115 -0
- data/NEWS +65 -0
- data/README.md +1 -1
- data/dist-files +0 -1
- data/docs/install-instant-client.md +1 -1
- data/docs/install-on-osx.md +29 -116
- data/ext/oci8/apiwrap.c.tmpl +2 -5
- data/ext/oci8/attr.c +4 -2
- data/ext/oci8/bind.c +6 -7
- data/ext/oci8/connection_pool.c +3 -3
- data/ext/oci8/extconf.rb +7 -4
- data/ext/oci8/hook_funcs.c +58 -17
- 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/oci8.h +1 -0
- data/ext/oci8/oci8lib.c +10 -7
- data/ext/oci8/ocihandle.c +2 -2
- data/ext/oci8/ocinumber.c +11 -9
- data/ext/oci8/oraconf.rb +128 -255
- data/ext/oci8/oradate.c +1 -1
- data/ext/oci8/plthook_osx.c +10 -10
- data/ext/oci8/stmt.c +4 -4
- data/ext/oci8/win32.c +4 -2
- data/lib/oci8/check_load_error.rb +1 -1
- data/lib/oci8/version.rb +1 -1
- data/lib/oci8.rb +8 -3
- data/ruby-oci8.gemspec +1 -1
- data/setup.rb +11 -2
- data/test/README.md +3 -6
- data/test/test_break.rb +9 -9
- data/test/test_datetime.rb +8 -3
- data/test/test_oranumber.rb +7 -1
- metadata +32 -52
- data/docs/osx-install-dev-tools.png +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1fedff79278c31d88dee698417671fb84c334ad61d08595662fcef4c792742eb
|
4
|
+
data.tar.gz: 8af51646f9e6c4f96be8baaf15582b1e510f8655ed4c4f06cc45f0ab2599e8ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3efe23976439e355436b273d28778a1658d01c1d0c57809e3d992600efc98d0455f44936b711026d7eb4dc9599dda6477367edb49823d125a4cc6d2ef3f2349
|
7
|
+
data.tar.gz: 9ff212eccdc0e737f648aaab32f4958e47f5c551823d6d9613b89cf8f5195561980f5cc5c0d34c7a88e591c045b601ff779cb5a7b562ca26c0efbaa532e198f2
|
data/ChangeLog
CHANGED
@@ -1,3 +1,118 @@
|
|
1
|
+
2020-12-30 Kubo Takehiro <kubo@jiubao.org>
|
2
|
+
* NEWS: Add changes between 2.2.8 and 2.2.9.
|
3
|
+
* lib/oci8/version.rb: Update to 2.2.9.
|
4
|
+
* mkpkg-win32.rb: remove unmaintained ruby versions from binary gems.
|
5
|
+
|
6
|
+
2020-12-29 Kubo Takehiro <kubo@jiubao.org>
|
7
|
+
* ext/oci8/oraconf.rb: Support --with-instant-client-dir along with --with-instant-client-lib/include.
|
8
|
+
(GH-223)
|
9
|
+
|
10
|
+
2020-12-29 Kubo Takehiro <kubo@jiubao.org>
|
11
|
+
* ext/oci8/hook_funcs.c: Fix hooking failure with truffleruby.
|
12
|
+
* test/test_break.rb: Fix to pass tests with truffleruby.
|
13
|
+
|
14
|
+
2020-12-28 Kubo Takehiro <kubo@jiubao.org>
|
15
|
+
* mkpkg-win32.rb: Build binary gems for ruby 3.0 on Windows.
|
16
|
+
|
17
|
+
2020-12-28 Kubo Takehiro <kubo@jiubao.org>
|
18
|
+
* ext/oci8/ocinumber.c: Suppress C compiler warning: enumeration value ‘RUBY_T_NONE’ not handled in switch
|
19
|
+
|
20
|
+
2020-09-10 Kubo Takehiro <kubo@jiubao.org>
|
21
|
+
* ext/oci8/extconf.rb: Fix for TruffleRuby 20.2 or before.
|
22
|
+
|
23
|
+
2020-09-08 Brandon Fish <brandon.j.fish@oracle.com>
|
24
|
+
* ext/oci8/extconf.rb, lib/oci8.rb: Handle truffleruby RUBY_ENGINE in case statements
|
25
|
+
|
26
|
+
2020-01-11 Kubo Takehiro <kubo@jiubao.org>
|
27
|
+
* NEWS: Add changes between 2.2.7 and 2.2.8.
|
28
|
+
* lib/oci8/version.rb: Update to 2.2.8.
|
29
|
+
|
30
|
+
2020-01-11 Kubo Takehiro <kubo@jiubao.org>
|
31
|
+
* ext/oci8/bind.c: Fix warning: comparison between signed and
|
32
|
+
unsigned integer expressions
|
33
|
+
|
34
|
+
2020-01-11 Kubo Takehiro <kubo@jiubao.org>
|
35
|
+
* test/README.md: Update preparation SQL statements for running tests.
|
36
|
+
|
37
|
+
2020-01-11 Kubo Takehiro <kubo@jiubao.org>
|
38
|
+
* test/test_break.rb: Check Oracle server OS where tests run
|
39
|
+
using dbms_utility.port_string. Tests in test_break.rb
|
40
|
+
failed on Windows.
|
41
|
+
|
42
|
+
2020-01-07 Kubo Takehiro <kubo@jiubao.org>
|
43
|
+
* mkpkg-win32.rb: Workarounds for compilation using ruby 2.4 and 2.6 with
|
44
|
+
latest msys2 to avoid 'undefined reference to __chk_fail'
|
45
|
+
|
46
|
+
2020-01-06 Kubo Takehiro <kubo@jiubao.org>
|
47
|
+
* ext/oci8/win32.c: Fix warnings caused by the change of rb_ensure()'s
|
48
|
+
arguments in ruby 2.7.
|
49
|
+
|
50
|
+
2019-12-16 Kubo Takehiro <kubo@jiubao.org>
|
51
|
+
* test/test_datetime.rb: Remove "require 'scanf'" to run tests with Ruby 2.7.
|
52
|
+
The 'scanf' library was removed. https://bugs.ruby-lang.org/issues/16170
|
53
|
+
|
54
|
+
2019-12-15 Kubo Takehiro <kubo@jiubao.org>
|
55
|
+
* ext/oci8/oradate.c: Fix bug of OraDate.now introduced 15 years ago.
|
56
|
+
|
57
|
+
2019-12-15 Kubo Takehiro <kubo@jiubao.org>
|
58
|
+
* ext/oci8/attr.c, ext/oci8/oci8lib.c: Fix warnings caused by the
|
59
|
+
change of rb_ensure()'s arguments in ruby 2.7.
|
60
|
+
|
61
|
+
2019-06-19 Kubo Takehiro <kubo@jiubao.org>
|
62
|
+
* Merge pull request #217 from nathanbwright/patch-1
|
63
|
+
Fix spelling in install-instant-client.md
|
64
|
+
(GH-217)
|
65
|
+
|
66
|
+
2019-06-18 Nathan Wright <nathanbwright@users.noreply.github.com>
|
67
|
+
* docs/install-instant-client.md: Fix spelling in install-instant-client.md
|
68
|
+
(GH-217)
|
69
|
+
|
70
|
+
2019-04-24 Kubo Takehiro <kubo@jiubao.org>
|
71
|
+
* Merge pull request #212 from tomasjura/master
|
72
|
+
Compilation fix for Windows ( and some small cleanups )
|
73
|
+
(GH-212)
|
74
|
+
|
75
|
+
2019-04-23 Tomas Jura <tomas.jura1@gmail.com>
|
76
|
+
* ext/oci8/oci8.h: eliminate compiler warning
|
77
|
+
(GH-212)
|
78
|
+
|
79
|
+
2019-04-20 Tomas Jura <tomas.jura1@gmail.com>
|
80
|
+
* ext/oci8/bind.c: compiler warning eliminated
|
81
|
+
(GH-212)
|
82
|
+
|
83
|
+
2019-04-20 Tomas Jura <tomas.jura1@gmail.com>
|
84
|
+
* setup.rb: use splat operator instead dummy variables
|
85
|
+
(GH-212)
|
86
|
+
|
87
|
+
2019-04-20 Tomas Jura <tomas.jura1@gmail.com>
|
88
|
+
* lib/oci8.rb: use fiddler instead obsolete Win32API
|
89
|
+
(GH-212)
|
90
|
+
|
91
|
+
2019-04-20 Tomas Jura <tomas.jura1@gmail.com>
|
92
|
+
* ext/oci8/oraconf.rb: fix typo in windows compilation
|
93
|
+
(GH-212)
|
94
|
+
|
95
|
+
2019-03-23 Kubo Takehiro <kubo@jiubao.org>
|
96
|
+
* Merge pull request #210 from dminuoso/allow-custom
|
97
|
+
(Nix) Allow for specifying include/library paths
|
98
|
+
(GH-210)
|
99
|
+
|
100
|
+
2019-03-23 Victor Nawothnig <Victor.Nawothnig@gmail.com>
|
101
|
+
* ext/oci8/oraconf.rb: Fix missing support for full client
|
102
|
+
(GH-210)
|
103
|
+
|
104
|
+
2019-03-22 Victor Nawothnig <Victor.Nawothnig@gmail.com>
|
105
|
+
* ext/oci8/oraconf.rb: fixup! Allow overriding library/include paths
|
106
|
+
(GH-210)
|
107
|
+
|
108
|
+
2019-03-21 Victor Nawothnig <Victor.Nawothnig@gmail.com>
|
109
|
+
* setup.rb: Add documentation for new flags
|
110
|
+
(GH-210)
|
111
|
+
|
112
|
+
2019-03-21 Victor Nawothnig <Victor.Nawothnig@gmail.com>
|
113
|
+
* ext/oci8/oraconf.rb: Allow overriding library/include paths
|
114
|
+
(GH-210)
|
115
|
+
|
1
116
|
2019-01-06 Kubo Takehiro <kubo@jiubao.org>
|
2
117
|
* NEWS: Add changes between 2.2.6.1 and 2.2.7.
|
3
118
|
* lib/oci8/version.rb: Update to 2.2.7
|
data/NEWS
CHANGED
@@ -1,5 +1,70 @@
|
|
1
1
|
# @markup markdown
|
2
2
|
|
3
|
+
2.2.11 (2022-02-22)
|
4
|
+
===================
|
5
|
+
|
6
|
+
- Fix "No DLL is not foud to hook" when `OCI8.properties[:tcp_keepalive_time]` is set and Oracle client is 21c on Windows.
|
7
|
+
|
8
|
+
(reported at rsim/oracle-enhanced#2262)
|
9
|
+
|
10
|
+
- Fix "OCI8.properties[:tcp_keepalive_time] isn't available" error when ruby version is 3.1 on Windows.
|
11
|
+
|
12
|
+
2.2.10 (2022-01-12)
|
13
|
+
===================
|
14
|
+
|
15
|
+
- Use `File.exist?` instead of removed `File.exists?` in Ruby 3.2 (GH-242)
|
16
|
+
|
17
|
+
(contributed by Yasuo Honda)
|
18
|
+
|
19
|
+
- Support ruby 3.1 distributed by rubyinstaller.org
|
20
|
+
|
21
|
+
- Remove code for obsolete platforms
|
22
|
+
- Ruby compiled by Borland C++
|
23
|
+
- macOS released several years ago
|
24
|
+
|
25
|
+
- Detect arm64 macOS shared library in oraconf.rb in preparation for Instant Client for Apple Silicon release.
|
26
|
+
|
27
|
+
2.2.9 (2020-12-30)
|
28
|
+
==================
|
29
|
+
|
30
|
+
- Support [TruffleRuby](https://github.com/oracle/truffleruby). (GH-225)
|
31
|
+
|
32
|
+
(contributed by Brandon Fish)
|
33
|
+
|
34
|
+
- Remove extension libraries for unmaintained ruby versions from binary gems.
|
35
|
+
|
36
|
+
Fixed issue
|
37
|
+
-----------
|
38
|
+
|
39
|
+
- Allow --with-instant-client-dir along with --with-instant-client-lib/include. (GH-223)
|
40
|
+
|
41
|
+
(reported by Victor Nawothnig)
|
42
|
+
|
43
|
+
2.2.8 (2020-01-11)
|
44
|
+
==================
|
45
|
+
|
46
|
+
New features
|
47
|
+
------------
|
48
|
+
|
49
|
+
* Add support to specify include and lib directories of Oracle library on installation. (GH-210)
|
50
|
+
|
51
|
+
The following three flags are added.
|
52
|
+
|
53
|
+
* --with-instant-client-dir
|
54
|
+
* --with-instant-client-include
|
55
|
+
* --with-instant-client-lib
|
56
|
+
|
57
|
+
Fixed issue
|
58
|
+
-----------
|
59
|
+
|
60
|
+
- Suppress warnings compiling oci8lib.so (GH-212 and others)
|
61
|
+
|
62
|
+
- Fix compilation and tests on Windows.
|
63
|
+
|
64
|
+
- Fix spelling in install-instant-client.md (GH-217)
|
65
|
+
|
66
|
+
- Use fiddler instead obsolete Win32API on Windows (GH-212)
|
67
|
+
|
3
68
|
2.2.7 (2019-01-06)
|
4
69
|
==================
|
5
70
|
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ Ruby-oci8
|
|
2
2
|
=========
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/ruby-oci8.svg)](http://badge.fury.io/rb/ruby-oci8)
|
5
|
-
[![
|
5
|
+
[![Tests](https://github.com/kubo/ruby-oci8/actions/workflows/tests.yml/badge.svg)](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
|
@@ -18,7 +18,7 @@ Look at {file:docs/install-on-osx.md} for OS X.
|
|
18
18
|
Install Oracle Instant Client Packages
|
19
19
|
--------------------------------------
|
20
20
|
|
21
|
-
###
|
21
|
+
### Download Instant Client Packages
|
22
22
|
|
23
23
|
Download the following packages from [Oracle Technology Network](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html).
|
24
24
|
|
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
|
-
![dialog](osx-install-dev-tools.png)
|
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/attr.c
CHANGED
@@ -15,8 +15,9 @@ typedef struct {
|
|
15
15
|
OCIRowid *ridp;
|
16
16
|
} rowid_arg_t;
|
17
17
|
|
18
|
-
static VALUE get_rowid_attr(
|
18
|
+
static VALUE get_rowid_attr(VALUE varg)
|
19
19
|
{
|
20
|
+
rowid_arg_t *arg = (rowid_arg_t *)varg;
|
20
21
|
oci8_base_t *base = arg->base;
|
21
22
|
ub4 attrtype = arg->attrtype;
|
22
23
|
char buf[MAX_ROWID_LEN];
|
@@ -36,8 +37,9 @@ static VALUE get_rowid_attr(rowid_arg_t *arg)
|
|
36
37
|
return rb_external_str_new_with_enc(buf, buflen, rb_usascii_encoding());
|
37
38
|
}
|
38
39
|
|
39
|
-
static VALUE rowid_ensure(
|
40
|
+
static VALUE rowid_ensure(VALUE varg)
|
40
41
|
{
|
42
|
+
rowid_arg_t *arg = (rowid_arg_t *)varg;
|
41
43
|
if (arg->ridp != NULL) {
|
42
44
|
OCIDescriptorFree(arg->ridp, OCI_DTYPE_ROWID);
|
43
45
|
}
|
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 = {
|
@@ -383,7 +383,7 @@ static sb4 in_bind_callback(void *ictxp, OCIBind *bindp, ub4 iter, ub4 index, vo
|
|
383
383
|
|
384
384
|
if (cb->tail == &cb->head) {
|
385
385
|
/* empty string */
|
386
|
-
*bufpp = "";
|
386
|
+
*bufpp = (void *)"";
|
387
387
|
*alenp = 0;
|
388
388
|
*piecep = OCI_ONE_PIECE;
|
389
389
|
} else {
|
@@ -470,14 +470,13 @@ 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
|
|
477
476
|
static void bind_long_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
|
478
477
|
{
|
479
478
|
chunk_buf_t *cb = (chunk_buf_t *)data;
|
480
|
-
|
479
|
+
ub4 len;
|
481
480
|
const char *buf;
|
482
481
|
|
483
482
|
if (IS_BIND_LONG(obind)) {
|
@@ -485,7 +484,7 @@ static void bind_long_set(oci8_bind_t *obind, void *data, void **null_structp, V
|
|
485
484
|
} else {
|
486
485
|
StringValue(val);
|
487
486
|
}
|
488
|
-
len = RSTRING_LEN(val);
|
487
|
+
len = (ub4)RSTRING_LEN(val);
|
489
488
|
buf = RSTRING_PTR(val);
|
490
489
|
cb->tail = &cb->head;
|
491
490
|
while (1) {
|
@@ -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/extconf.rb
CHANGED
@@ -72,7 +72,7 @@ $objs = ["oci8lib.o", "env.o", "error.o", "oci8.o", "ocihandle.o",
|
|
72
72
|
"ocinumber.o", "ocidatetime.o", "object.o", "apiwrap.o",
|
73
73
|
"encoding.o", "oranumber_util.o", "thread_util.o", "util.o"]
|
74
74
|
|
75
|
-
if RUBY_PLATFORM =~ /mswin32|cygwin|
|
75
|
+
if RUBY_PLATFORM =~ /mswin32|cygwin|mingw/
|
76
76
|
$defs << "-DUSE_WIN32_C"
|
77
77
|
$objs << "win32.o"
|
78
78
|
end
|
@@ -139,6 +139,8 @@ when 'rbx'
|
|
139
139
|
so_basename += 'rbx'
|
140
140
|
when 'jruby'
|
141
141
|
raise "Ruby-oci8 doesn't support jruby because its C extension support is in development in jruby 1.6 and deprecated in jruby 1.7."
|
142
|
+
when 'truffleruby'
|
143
|
+
so_basename += 'truffleruby'
|
142
144
|
else
|
143
145
|
raise 'unsupported ruby engine: ' + RUBY_ENGINE
|
144
146
|
end
|
@@ -146,15 +148,16 @@ end
|
|
146
148
|
print "checking for plthook... "
|
147
149
|
STDOUT.flush
|
148
150
|
case RUBY_PLATFORM
|
149
|
-
when /mswin32|cygwin|
|
151
|
+
when /mswin32|cygwin|mingw/
|
150
152
|
plthook_src = "plthook_win32.c"
|
151
153
|
when /darwin/
|
152
154
|
plthook_src = "plthook_osx.c"
|
153
155
|
else
|
154
156
|
plthook_src = "plthook_elf.c"
|
155
157
|
end
|
156
|
-
|
157
|
-
|
158
|
+
FileUtils.copy(File.dirname(__FILE__) + "/" + plthook_src, CONFTEST_C)
|
159
|
+
if xsystem(cc_command(""))
|
160
|
+
FileUtils.rm_f("#{CONFTEST}.#{$OBJEXT}")
|
158
161
|
puts plthook_src
|
159
162
|
$objs << plthook_src.gsub(/\.c$/, '.o')
|
160
163
|
$objs << "hook_funcs.o"
|
data/ext/oci8/hook_funcs.c
CHANGED
@@ -170,6 +170,38 @@ static int WSAAPI hook_WSARecv(SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount
|
|
170
170
|
return rv;
|
171
171
|
}
|
172
172
|
|
173
|
+
static int is_target_dll(MODULEENTRY32 *me)
|
174
|
+
{
|
175
|
+
static const char *basenames[] = {
|
176
|
+
"orantcp", // ORACLE_HOME-based client
|
177
|
+
"oraociei", // instant client basic
|
178
|
+
"oraociicus", // instant client basic lite
|
179
|
+
NULL,
|
180
|
+
};
|
181
|
+
const char **basename = basenames;
|
182
|
+
while (*basename != NULL) {
|
183
|
+
if (strnicmp(me->szModule, *basename, strlen(*basename)) == 0) {
|
184
|
+
break;
|
185
|
+
}
|
186
|
+
basename++;
|
187
|
+
}
|
188
|
+
if (*basename == NULL) {
|
189
|
+
return 0;
|
190
|
+
}
|
191
|
+
// basename{zero_or_more_digits}.dll
|
192
|
+
const char *p = me->szModule + strlen(*basename);
|
193
|
+
while ('0' <= *p && *p <= '9') {
|
194
|
+
p++;
|
195
|
+
}
|
196
|
+
if (stricmp(p, ".dll") != 0) {
|
197
|
+
return 0;
|
198
|
+
}
|
199
|
+
if (GetProcAddress((HMODULE)me->modBaseAddr, "nttini") == NULL) {
|
200
|
+
return 0;
|
201
|
+
}
|
202
|
+
return 1;
|
203
|
+
}
|
204
|
+
|
173
205
|
void oci8_install_hook_functions()
|
174
206
|
{
|
175
207
|
static int hook_functions_installed = 0;
|
@@ -217,22 +249,11 @@ void oci8_install_hook_functions()
|
|
217
249
|
me.dwSize = sizeof(me);
|
218
250
|
if (Module32First(hSnapshot, &me)) {
|
219
251
|
do {
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
} else if (strnicmp(me.szModule, "oraociicus", 10) == 0) { // instant client basic lite
|
226
|
-
p = me.szModule + 10;
|
227
|
-
}
|
228
|
-
if (p != NULL && ('1' <= *p && *p <= '9') && ('0' <= *(p + 1) && *(p + 1) <= '9')
|
229
|
-
&& stricmp(p + 2, ".dll") == 0) {
|
230
|
-
if (GetProcAddress((HMODULE)me.modBaseAddr, "nttini") != NULL) {
|
231
|
-
module_found = TRUE;
|
232
|
-
if (replace_functions(me.modBaseAddr, me.szExePath, tcp_functions) != 0) {
|
233
|
-
CloseHandle(hSnapshot);
|
234
|
-
rb_raise(rb_eRuntimeError, "Hook error: %s", hook_errmsg);
|
235
|
-
}
|
252
|
+
if (is_target_dll(&me)) {
|
253
|
+
module_found = TRUE;
|
254
|
+
if (replace_functions(me.modBaseAddr, me.szExePath, tcp_functions) != 0) {
|
255
|
+
CloseHandle(hSnapshot);
|
256
|
+
rb_raise(rb_eRuntimeError, "Hook error: %s", hook_errmsg);
|
236
257
|
}
|
237
258
|
}
|
238
259
|
} while (Module32Next(hSnapshot, &me));
|
@@ -298,13 +319,28 @@ static void *ocifunc_addr(void *dlsym_handle, const char **file)
|
|
298
319
|
if (dladdr(addr, &dli) == 0) {
|
299
320
|
return NULL;
|
300
321
|
}
|
301
|
-
if (strstr(dli.dli_fname, "/libclntsh." SO_EXT) ==
|
322
|
+
if (strstr(dli.dli_fname, "/libclntsh." SO_EXT) == NULL) {
|
302
323
|
return NULL;
|
303
324
|
}
|
304
325
|
*file = dli.dli_fname;
|
305
326
|
return addr;
|
306
327
|
}
|
307
328
|
|
329
|
+
#ifdef __linux__
|
330
|
+
#include <link.h>
|
331
|
+
static void *ocifunc_addr_linux(const char **file)
|
332
|
+
{
|
333
|
+
struct link_map *lm;
|
334
|
+
for (lm = _r_debug.r_map; lm != NULL; lm = lm->l_next) {
|
335
|
+
if (strstr(lm->l_name, "/libclntsh." SO_EXT) != NULL) {
|
336
|
+
*file = lm->l_name;
|
337
|
+
return (void*)lm->l_addr;
|
338
|
+
}
|
339
|
+
}
|
340
|
+
return NULL;
|
341
|
+
}
|
342
|
+
#endif
|
343
|
+
|
308
344
|
void oci8_install_hook_functions(void)
|
309
345
|
{
|
310
346
|
static int hook_functions_installed = 0;
|
@@ -319,6 +355,11 @@ void oci8_install_hook_functions(void)
|
|
319
355
|
/* OCI symbols may be hooked by LD_PRELOAD. */
|
320
356
|
addr = ocifunc_addr(RTLD_NEXT, &file);
|
321
357
|
}
|
358
|
+
#ifdef __linux__
|
359
|
+
if (addr == NULL) {
|
360
|
+
addr = ocifunc_addr_linux(&file);
|
361
|
+
}
|
362
|
+
#endif
|
322
363
|
if (addr == NULL) {
|
323
364
|
rb_raise(rb_eRuntimeError, "No shared library is found to hook.");
|
324
365
|
}
|