ruby-oci8 2.2.0.2 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +1 -6
- data/ChangeLog +600 -0
- data/NEWS +426 -35
- data/README.md +27 -9
- data/dist-files +13 -2
- data/docs/bind-array-to-in_cond.md +38 -0
- data/docs/conflicts-local-connections-and-processes.md +98 -0
- data/docs/hanging-after-inactivity.md +63 -0
- data/docs/install-binary-package.md +15 -11
- data/docs/install-full-client.md +18 -21
- data/docs/install-instant-client.md +45 -27
- data/docs/install-on-osx.md +31 -117
- data/docs/ldap-auth-and-function-interposition.md +123 -0
- data/docs/number-type-mapping.md +79 -0
- data/docs/platform-specific-issues.md +17 -50
- data/docs/report-installation-issue.md +11 -8
- data/docs/timeout-parameters.md +94 -0
- data/ext/oci8/apiwrap.c.tmpl +2 -5
- data/ext/oci8/apiwrap.rb +6 -1
- data/ext/oci8/apiwrap.yml +39 -143
- data/ext/oci8/attr.c +4 -2
- data/ext/oci8/bind.c +421 -9
- data/ext/oci8/connection_pool.c +3 -3
- data/ext/oci8/encoding.c +5 -5
- data/ext/oci8/env.c +8 -2
- data/ext/oci8/error.c +24 -16
- data/ext/oci8/extconf.rb +35 -63
- data/ext/oci8/hook_funcs.c +274 -61
- data/ext/oci8/lob.c +31 -75
- data/ext/oci8/metadata.c +8 -6
- data/ext/oci8/object.c +119 -29
- data/ext/oci8/oci8.c +46 -133
- data/ext/oci8/oci8.h +40 -123
- data/ext/oci8/oci8lib.c +178 -46
- data/ext/oci8/ocihandle.c +37 -37
- data/ext/oci8/ocinumber.c +24 -35
- data/ext/oci8/oraconf.rb +168 -337
- data/ext/oci8/oradate.c +19 -19
- data/ext/oci8/plthook.h +10 -0
- data/ext/oci8/plthook_elf.c +433 -268
- data/ext/oci8/plthook_osx.c +40 -9
- data/ext/oci8/plthook_win32.c +16 -1
- data/ext/oci8/stmt.c +52 -17
- data/ext/oci8/win32.c +4 -22
- data/lib/oci8/bindtype.rb +10 -17
- data/lib/oci8/check_load_error.rb +57 -10
- data/lib/oci8/compat.rb +5 -1
- data/lib/oci8/connection_pool.rb +74 -3
- data/lib/oci8/cursor.rb +70 -31
- data/lib/oci8/metadata.rb +9 -1
- data/lib/oci8/object.rb +14 -1
- data/lib/oci8/oci8.rb +184 -58
- data/lib/oci8/ocihandle.rb +0 -16
- data/lib/oci8/oracle_version.rb +11 -1
- data/lib/oci8/properties.rb +55 -0
- data/lib/oci8/version.rb +1 -1
- data/lib/oci8.rb +48 -4
- data/lib/ruby-oci8.rb +1 -0
- data/pre-distclean.rb +1 -3
- data/ruby-oci8.gemspec +4 -9
- data/setup.rb +11 -2
- data/test/README.md +37 -0
- data/test/config.rb +8 -1
- data/test/setup_test_object.sql +42 -14
- data/test/setup_test_package.sql +59 -0
- data/test/test_all.rb +4 -0
- data/test/test_bind_array.rb +70 -0
- data/test/test_bind_boolean.rb +99 -0
- data/test/test_bind_integer.rb +47 -0
- data/test/test_break.rb +11 -9
- data/test/test_clob.rb +5 -17
- data/test/test_connstr.rb +142 -0
- data/test/test_datetime.rb +8 -3
- data/test/test_metadata.rb +2 -1
- data/test/test_object.rb +99 -18
- data/test/test_oci8.rb +170 -46
- data/test/test_oranumber.rb +12 -6
- data/test/test_package_type.rb +17 -3
- data/test/test_properties.rb +17 -0
- metadata +45 -55
- data/docs/osx-install-dev-tools.png +0 -0
- data/test/README +0 -42
@@ -0,0 +1,123 @@
|
|
1
|
+
# @title LDAP Authentication and Function Interposition
|
2
|
+
|
3
|
+
LDAP Authentication and Function Interposition
|
4
|
+
==============================================
|
5
|
+
|
6
|
+
Problems
|
7
|
+
--------
|
8
|
+
|
9
|
+
The following code may trigger segmentation faults or unexpected behaviours.
|
10
|
+
|
11
|
+
require 'pg' # or any modules using LDAP such as ActiveLdap
|
12
|
+
require 'oci8'
|
13
|
+
|
14
|
+
conn = OCI8.new('username/password@dbname.example.com')
|
15
|
+
...
|
16
|
+
|
17
|
+
It happens when all the following conditions are satisfied.
|
18
|
+
|
19
|
+
* The platform is Unix
|
20
|
+
* The PostgreSQL client library, which `pg` depends, was compiled with LDAP support.
|
21
|
+
* LDAP authentication is used to connect to an Oracle server.
|
22
|
+
|
23
|
+
It is caused by function interposition as follows:
|
24
|
+
|
25
|
+
* The ruby process loads `pq` and its depending libraries such as
|
26
|
+
`libpq.so`(PostgreSQL client library) and `libldap_r.so`(LDAP library).
|
27
|
+
* Then it loads `oci8` and its depending libraries such as
|
28
|
+
`libclntsh.so`(Oracle client library).
|
29
|
+
* When LDAP authentication is used, `libclntsh.so` tries to use
|
30
|
+
LDAP functions in the library.
|
31
|
+
* However it uses LDAP functions in `libldap_r.so` because the function
|
32
|
+
in the firstly loaded library is used when more than one library exports
|
33
|
+
functions whose names are same.
|
34
|
+
* It triggers segmentation faults or unexpected behaviours because
|
35
|
+
implementations of LDAP functions are different even though their names
|
36
|
+
are same.
|
37
|
+
|
38
|
+
The reverse may cause same results by the following code.
|
39
|
+
|
40
|
+
require 'oci8'
|
41
|
+
require 'pg'
|
42
|
+
|
43
|
+
... connect to PostgreSQL using LDAP ...
|
44
|
+
|
45
|
+
### Note for macOS
|
46
|
+
|
47
|
+
Libraries in two-level namespaces are free from function interposition on macOS.
|
48
|
+
See the second paragraph of [this document][mach-o]. If `TWOLEVEL` is
|
49
|
+
found in the output of `otool -hV /path/to/library`, it is in a
|
50
|
+
two-level namespace. Otherwise it is in a single-level (flat) namespace.
|
51
|
+
|
52
|
+
Oracle client library (`libclntsh.dylib.12.1`) is in a flat namespace.
|
53
|
+
It suffers from function interposition.
|
54
|
+
|
55
|
+
$ otool -hV libclntsh.dylib.12.1
|
56
|
+
Mach header
|
57
|
+
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
|
58
|
+
MH_MAGIC_64 X86_64 ALL 0x00 DYLIB 19 2360 DYLDLINK NO_REEXPORTED_DYLIBS MH_HAS_TLV_DESCRIPTORS
|
59
|
+
|
60
|
+
PostgreSQL client library (`libpq.5.dylib`) installed by [brew][] depends on an OS-supplied LDAP library.
|
61
|
+
|
62
|
+
$ otool -L libpq.5.dylib
|
63
|
+
libpq.5.dylib:
|
64
|
+
/usr/local/opt/postgresql/lib/libpq.5.dylib (compatibility version 5.0.0, current version 5.9.0)
|
65
|
+
/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
|
66
|
+
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
|
67
|
+
/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 6.0.0)
|
68
|
+
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.4.0)
|
69
|
+
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
|
70
|
+
|
71
|
+
The OS-supplied LDAP library is in a two-level namespace.
|
72
|
+
|
73
|
+
$ otool -hV /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP
|
74
|
+
Mach header
|
75
|
+
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
|
76
|
+
MH_MAGIC_64 X86_64 ALL 0x00 DYLIB 22 2528 NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS APP_EXTENSION_SAFE
|
77
|
+
|
78
|
+
As a result, the PostgreSQL client library is free from function interposition.
|
79
|
+
|
80
|
+
Solution 1
|
81
|
+
----------
|
82
|
+
|
83
|
+
If you don't connect to PostgreSQL using LDAP, use the following code.
|
84
|
+
|
85
|
+
require 'oci8' # This must be before "require 'pg'".
|
86
|
+
require 'pg'
|
87
|
+
|
88
|
+
conn = OCI8.new('username/password@dbname.example.com')
|
89
|
+
...
|
90
|
+
... connect to a PostgreSQL server ...
|
91
|
+
|
92
|
+
Oracle client library uses LDAP functions in `libclntsh.so` because `libclntsh.so`
|
93
|
+
is loaded before `libldap_r.so`.
|
94
|
+
|
95
|
+
Don't connect to PostgreSQL using LDAP because `libpq.so` tries to use
|
96
|
+
LDAP functions in `libldap_r.so` but faultily uses functions in `libclntsh.so`.
|
97
|
+
|
98
|
+
Note for macOS: This fixes all function interposition issues if the LDAP library
|
99
|
+
in a two-level namespace.
|
100
|
+
|
101
|
+
Solution 2
|
102
|
+
----------
|
103
|
+
|
104
|
+
If LDAP is used to connect to both Oracle and PostgreSQL and the platform
|
105
|
+
is Linux or macOS, use ruby-oci8 2.2.4 or later and use the following code.
|
106
|
+
|
107
|
+
require 'pg'
|
108
|
+
require 'oci8' # This must be after "require 'pg'".
|
109
|
+
|
110
|
+
conn = OCI8.new('username/password@dbname.example.com')
|
111
|
+
...
|
112
|
+
... connect to a PostgreSQL server using LDAP ...
|
113
|
+
|
114
|
+
PostgreSQL client library uses LDAP functions in `libldap_r.so` because `libldap_r.so`
|
115
|
+
is loaded before `libclntsh.so`.
|
116
|
+
|
117
|
+
Oracle client library uses LDAP functions in `libclntsh.so` because ruby-oci8
|
118
|
+
forcedly modifies PLT (Procedure Linkage Table) entries to point to
|
119
|
+
functions in `libclntsh.so` if they point to functions in other libraries.
|
120
|
+
(PLT is equivalent to IAT (Import Address Table) on Windows.)
|
121
|
+
|
122
|
+
[mach-o]: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/MachOTopics/1-Articles/executing_files.html
|
123
|
+
[brew]: http://brew.sh/
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# @title Number Type Mapping between Oracle and Ruby
|
2
|
+
|
3
|
+
Number Type Mapping between Oracle and Ruby
|
4
|
+
===========================================
|
5
|
+
|
6
|
+
Default mapping
|
7
|
+
---------------
|
8
|
+
|
9
|
+
Oracle numbers in select statements are fetched as followings by default:
|
10
|
+
|
11
|
+
| Oracle Data Type | Ruby Class |
|
12
|
+
|---|---|
|
13
|
+
| NUMBER(prec) or NUMBER(prec, 0) | Integer |
|
14
|
+
| NUMBER(prec, scale) where prec < 15 and scale != 0 | Float |
|
15
|
+
| NUMBER(prec, scale) where prec >= 15 and scale != 0 | BigDecimal |
|
16
|
+
| FLOAT or FLOAT(prec) | Float |
|
17
|
+
| NUMBER without precision and scale | BigDecimal |
|
18
|
+
| number type returned by functions or calculated number | BigDecimal |
|
19
|
+
| BINARY_FLOAT | Float |
|
20
|
+
| BINARY_DOUBLE | Float |
|
21
|
+
|
22
|
+
When the data type is within Integer or Float class, it is fetched
|
23
|
+
as Integer or Float. Otherwise, BigDecimal.
|
24
|
+
|
25
|
+
Note that the mapping is determined by the column definition in
|
26
|
+
select statements, not by the actual value fetched.
|
27
|
+
For example the column in `select count(*) from table_name` is
|
28
|
+
fetched as BigDecimal because it is returned from `count` function.
|
29
|
+
|
30
|
+
The mapping is customizable by `OCI8::BindType::Mapping`.
|
31
|
+
The default values of Oracle number data type mapping are:
|
32
|
+
|
33
|
+
# NUMBER or FLOAT data type, used for the first six rows in the above table
|
34
|
+
OCI8::BindType::Mapping[:number] = OCI8::BindType::Number
|
35
|
+
# BINARY_FLOAT data type, used for the seventh row in the above table
|
36
|
+
OCI8::BindType::Mapping[:binary_float] = OCI8::BindType::BinaryDouble
|
37
|
+
# BINARY_DOUBLE data type, used for the eighth row in the above table
|
38
|
+
OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::BinaryDouble
|
39
|
+
|
40
|
+
`OCI8::BindType::Number` checks precision and scale to determine
|
41
|
+
ruby class. The first four rows in the above table are hard-coded.
|
42
|
+
The fifth and sixth rows are, however, customizable by
|
43
|
+
`OCI8::BindType::Mapping[:number_no_prec_setting]` and
|
44
|
+
`OCI8::BindType::Mapping[:number_unknown_prec]` respectively.
|
45
|
+
|
46
|
+
The default values are:
|
47
|
+
|
48
|
+
OCI8::BindType::Mapping[:number_no_prec_setting] = OCI8::BindType::BigDecimal
|
49
|
+
OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::BigDecimal
|
50
|
+
|
51
|
+
The mapping may be changed as follows in future.
|
52
|
+
|
53
|
+
| Oracle Data Type | Ruby Class |
|
54
|
+
|---|---|
|
55
|
+
| NUMBER(prec) or NUMBER(prec, 0) | Integer |
|
56
|
+
| other NUMBER | OraNumber |
|
57
|
+
| BINARY_FLOAT | Float |
|
58
|
+
| BINARY_DOUBLE | Float |
|
59
|
+
|
60
|
+
Customize mapping
|
61
|
+
-----------------
|
62
|
+
|
63
|
+
Add the following code to fetch all number or float columns as {OraNumber}.
|
64
|
+
|
65
|
+
OCI8::BindType::Mapping[:number] = OCI8::BindType::OraNumber
|
66
|
+
|
67
|
+
Otherwise, add the following code to customize the fifth and sixth rows only
|
68
|
+
in the above table.
|
69
|
+
|
70
|
+
OCI8::BindType::Mapping[:number_no_prec_setting] = OCI8::BindType::OraNumber
|
71
|
+
OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::OraNumber
|
72
|
+
|
73
|
+
If you want to fetch numbers as Integer or Float by its actual value, use
|
74
|
+
the following code:
|
75
|
+
|
76
|
+
# Fetch numbers as Integer when their fractional part is zero.
|
77
|
+
# Otherwise, Float. For example when a column contains 10 and
|
78
|
+
# 10.1, they are fetched as Integer and Float respectively.
|
79
|
+
OCI8::BindType::Mapping[:number] = OCI8::BindType::BasicNumberType
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# @title Platform Specific Issues
|
2
2
|
|
3
|
+
Platform Specific Issues
|
4
|
+
========================
|
5
|
+
|
3
6
|
Linux
|
4
|
-
|
7
|
+
-----
|
5
8
|
|
6
|
-
Ubuntu 11.10 (Oneiric Ocelot)
|
7
|
-
-----------------------------
|
9
|
+
### Ubuntu 11.10 (Oneiric Ocelot)
|
8
10
|
|
9
11
|
If the following error occurs even though libc6-dev is installed,
|
10
12
|
|
@@ -15,8 +17,7 @@ You need to use ruby-oci8 2.1.0 or upper. Otherwise, run the following command a
|
|
15
17
|
|
16
18
|
$ sudo ln -s /usr/include/linux/ /usr/include/sys
|
17
19
|
|
18
|
-
General Linux
|
19
|
-
-------------
|
20
|
+
### General Linux
|
20
21
|
|
21
22
|
Use the same bit-width of libraries with ruby. For example, x86\_64
|
22
23
|
instant client for x86\_64 ruby and 32-bit instant client for 32-bit
|
@@ -32,21 +33,18 @@ To check which type of ruby do you use:
|
|
32
33
|
Note: "`" is a back quote.
|
33
34
|
|
34
35
|
Mac OS X
|
35
|
-
|
36
|
+
--------
|
36
37
|
|
37
|
-
OS X 10.7+
|
38
|
-
----------
|
38
|
+
### OS X 10.7+
|
39
39
|
|
40
40
|
Use the latest 64-bit instant client. The older 64-bit (10.2.0.4) instant client [doesn't work](https://forums.oracle.com/forums/thread.jspa?threadID=2187558). The older 32-bit instant client will work but only with 32-bit ruby or jruby (using JDBC).
|
41
41
|
|
42
|
-
Intel Mac (64-bit)
|
43
|
-
------------------
|
42
|
+
### Intel Mac (64-bit)
|
44
43
|
|
45
44
|
See [How to setup Ruby and Oracle Instant Client on Snow Leopard](http://blog.rayapps.com/2009/09/06/how-to-setup-ruby-and-oracle-instant-client-on-snow-leopard/).
|
46
45
|
Note that setting the environment variable RC\_ARCHS=x86\_64 instead of ARCHFLAGS="-arch x86\_64" will work fine also.
|
47
46
|
|
48
|
-
Intel Mac (32-bit)
|
49
|
-
------------------
|
47
|
+
### Intel Mac (32-bit)
|
50
48
|
|
51
49
|
See [How to setup Ruby and Oracle Instant Client on Snow Leopard](http://blog.rayapps.com/2009/09/06/how-to-setup-ruby-and-oracle-instant-client-on-snow-leopard/). Note that you need to replace x86\_64 with i386 in the blog.
|
52
50
|
|
@@ -57,13 +55,12 @@ use one of the following workarounds.
|
|
57
55
|
* use [ruby-odbc](http://www.ch-werner.de/rubyodbc/) and a third party ODBC driver ([Actual Technologies](http://www.actualtechnologies.com) or [OpenLink Software](http://uda.openlinksw.com/)).
|
58
56
|
* use JRuby and Oracle JDBC driver.
|
59
57
|
|
60
|
-
PowerPC Mac
|
61
|
-
-----------
|
58
|
+
### PowerPC Mac
|
62
59
|
|
63
60
|
See [How to setup Ruby and Oracle Instant Client on Snow Leopard](http://blog.rayapps.com/2009/09/06/how-to-setup-ruby-and-oracle-instant-client-on-snow-leopard/). Note that you need to replace x86\_64 with ppc in the blog.
|
64
61
|
|
65
62
|
Solaris
|
66
|
-
|
63
|
+
-------
|
67
64
|
|
68
65
|
You need a same compiler which is used to make ruby itself.
|
69
66
|
For example, if the ruby is compiled by gcc, you need gcc. If it is compiled by Oracle Solaris Studio
|
@@ -83,15 +80,10 @@ as follows:
|
|
83
80
|
to: CONFIG["LDFLAGS"] = "-L. "
|
84
81
|
|
85
82
|
FreeBSD
|
86
|
-
|
87
|
-
|
88
|
-
There are two ways.
|
83
|
+
-------
|
89
84
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
linux emulator
|
94
|
-
--------------
|
85
|
+
Oracle8-client port isn't available because it is too old.
|
86
|
+
You need to use linux emulator.
|
95
87
|
|
96
88
|
I have not run ruby-oci8 on linux emulator, but I guess it will
|
97
89
|
run as follows. If it works, please tell me.
|
@@ -129,33 +121,8 @@ On freebsd:
|
|
129
121
|
cd /compat/linux/usr/local
|
130
122
|
tar xvfz ruby-1.8.x-linux.tar.gz
|
131
123
|
|
132
|
-
oracle8-client port
|
133
|
-
-------------------
|
134
|
-
|
135
|
-
I don't recommend this because of the following two reasons.
|
136
|
-
|
137
|
-
* The oracle8-client port is made from Oracle 8.1.7.1 static library for Linux. Oracle have not supported the connectivity between 8.1.7.1 and Oracle 10g.
|
138
|
-
* It is very unstable. When it fails to connect to an Oracle server, it is down by segmentation fault on FreeBSD 7.0 not only when using ruby-oci8, but also by a very simple test code written by C.
|
139
|
-
|
140
|
-
If you try to use oracle8-client port, compile and install as follows.
|
141
|
-
|
142
|
-
* install oracle8-client
|
143
|
-
|
144
|
-
cd /usr/ports/databases/oracle8-client
|
145
|
-
make
|
146
|
-
make install
|
147
|
-
|
148
|
-
* set an environment variable ORACLE\_HOME
|
149
|
-
|
150
|
-
export ORACLE_HOME=/usr/local/oracle8-client
|
151
|
-
|
152
|
-
The rest steps are described at {file:docs/install-full-client.md}.
|
153
|
-
|
154
|
-
note: You have no need to set LD\_LIBRARY\_PATH because
|
155
|
-
Oracle libraries in oracle8-client port are static ones.
|
156
|
-
|
157
124
|
HP-UX
|
158
|
-
|
125
|
+
-----
|
159
126
|
|
160
127
|
You need a ruby which is linked with ''libpthread'' and ''libcl''.
|
161
128
|
|
@@ -174,7 +141,7 @@ and `make install`.
|
|
174
141
|
The rest steps are described at {file:docs/install-full-client.md}.
|
175
142
|
|
176
143
|
Windows
|
177
|
-
|
144
|
+
-------
|
178
145
|
|
179
146
|
On some machines using a slow disk, you may get the following error.
|
180
147
|
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# @title Report Installation Issues
|
2
2
|
|
3
|
+
Report Installation Issues
|
4
|
+
==========================
|
5
|
+
|
3
6
|
Look at {file:docs/platform-specific-issues.md} and [the issues page on github][github] to check whether your issue is fixed or not.
|
4
7
|
|
5
8
|
If it is a new one, post the following information to [github][].
|
@@ -20,14 +23,14 @@ If it is a new one, post the following information to [github][].
|
|
20
23
|
|
21
24
|
file `which ruby`
|
22
25
|
ruby --version
|
23
|
-
ruby -r rbconfig -e "p
|
24
|
-
ruby -r rbconfig -e "p
|
25
|
-
ruby -r rbconfig -e "p
|
26
|
-
ruby -r rbconfig -e "p
|
27
|
-
ruby -r rbconfig -e "p
|
28
|
-
ruby -r rbconfig -e "p
|
29
|
-
ruby -r rbconfig -e "p
|
30
|
-
ruby -r rbconfig -e "p
|
26
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['host']"
|
27
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['CC']"
|
28
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['CFLAGS']"
|
29
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['LDSHARED']"
|
30
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['LDFLAGS']"
|
31
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['DLDLAGS']"
|
32
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['LIBS']"
|
33
|
+
ruby -r rbconfig -e "p RbConfig::CONFIG['GNU_LD']"
|
31
34
|
|
32
35
|
# if you use gcc,
|
33
36
|
gcc --print-prog-name=ld
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# @title Timeout Parameters
|
2
|
+
|
3
|
+
Timeout Parameters
|
4
|
+
==================
|
5
|
+
|
6
|
+
The following timeout parameters are available since ruby-oci8 2.2.2.
|
7
|
+
|
8
|
+
* tcp_connect_timeout
|
9
|
+
* connect_timeout
|
10
|
+
* send_timeout
|
11
|
+
* recv_timeout
|
12
|
+
|
13
|
+
For example:
|
14
|
+
|
15
|
+
OCI8.properties[:tcp_connect_timeout] = 10
|
16
|
+
OCI8.properties[:connect_timeout] = 15
|
17
|
+
OCI8.properties[:send_timeout] = 60
|
18
|
+
OCI8.properties[:recv_timeout] = 60
|
19
|
+
|
20
|
+
These parameters are applied only to TCP/IP connections.
|
21
|
+
|
22
|
+
The first two parameters `tcp_connect_timeout` and `connect_timeout`
|
23
|
+
are applied only to [connect descriptors][connect descriptor] using [Easy Connect Naming Method][EZCONNECT].
|
24
|
+
If you use a net service name, you should set [TRANSPORT_CONNECT_TIMEOUT][] and/or
|
25
|
+
[CONNECT_TIMEOUT][] in the address descriptor in `tnsnames.ora` instead of these parameters.
|
26
|
+
If you use easy connect naming method without any of `port`, `service_name`, `server` and `instance_name`,
|
27
|
+
you need to use `//host` to distinguish it from a net service name.
|
28
|
+
|
29
|
+
The next two parameters `send_timeout` and `recv_timeout` are available on Oracle 11g client
|
30
|
+
or upper. Use these parameters to prevent a ruby process from being blocked by poor quality network.
|
31
|
+
Otherwise, the ruby process may be blocked until TCP keepalive time (2 hours).
|
32
|
+
|
33
|
+
See {file:docs/hanging-after-inactivity.md Hanging After a Long Period of Inactivity}
|
34
|
+
for TCP keepalive time.
|
35
|
+
|
36
|
+
tcp_connect_timeout
|
37
|
+
-------------------
|
38
|
+
|
39
|
+
`tcp_connect_timeout` is equivalent to [TCP.CONNECT_TIMEOUT][] in the client-side `sqlnet.ora` and
|
40
|
+
[TRANSPORT_CONNECT_TIMEOUT][] in the address descriptor.
|
41
|
+
See description about [TCP.CONNECT_TIMEOUT][] and [TRANSPORT_CONNECT_TIMEOUT][].
|
42
|
+
|
43
|
+
connect_timeout
|
44
|
+
---------------
|
45
|
+
|
46
|
+
`connect_timeout` is equivalent to [SQLNET.OUTBOUND_CONNECT_TIMEOUT][] in the client-side `sqlnet.ora`
|
47
|
+
and [CONNECT_TIMEOUT][] in the address description.
|
48
|
+
See description about [SQLNET.OUTBOUND_CONNECT_TIMEOUT][] and [CONNECT_TIMEOUT][].
|
49
|
+
|
50
|
+
Note: this parameter isn't equivalent to login timeout. It needs the following three
|
51
|
+
steps to establish a database connection.
|
52
|
+
|
53
|
+
1. Establish a TCP/IP connection.
|
54
|
+
2. Establish an [Oracle Net][] connection on the TCP/IP connection.
|
55
|
+
3. Authenticate and authorize the database user.
|
56
|
+
|
57
|
+
`tcp_connect_timeout` sets the timeout of the first step.
|
58
|
+
`connect_timeout` sets the total timeout of the first and the second steps.
|
59
|
+
There is no timeout parameter to limit the maximum time of all three steps.
|
60
|
+
|
61
|
+
Use `send_timeout` and `recv_timeout` in case that a TCP/IP connection stalls
|
62
|
+
in the third step.
|
63
|
+
|
64
|
+
send_timeout
|
65
|
+
------------
|
66
|
+
|
67
|
+
`send_timeout` is equivalent to [SQLNET.SEND_TIMEOUT][] in the client-side `sqlnet.ora`.
|
68
|
+
See description about [SQLNET.SEND_TIMEOUT][].
|
69
|
+
|
70
|
+
Note that the connection becomes unusable on timeout.
|
71
|
+
|
72
|
+
See also {OCI8#send_timeout=}.
|
73
|
+
|
74
|
+
recv_timeout
|
75
|
+
------------
|
76
|
+
|
77
|
+
`recv_timeout` is equivalent to [SQLNET.RECV_TIMEOUT][] in the client-side `sqlnet.ora`.
|
78
|
+
See description about [SQLNET.RECV_TIMEOUT][].
|
79
|
+
|
80
|
+
Note that the connection becomes unusable on timeout.
|
81
|
+
|
82
|
+
See also {OCI8#recv_timeout=}.
|
83
|
+
|
84
|
+
Note: This parameter must be larger than the longest SQL execution time in your applications.
|
85
|
+
|
86
|
+
[TCP.CONNECT_TIMEOUT]: http://docs.oracle.com/database/121/NETRF/sqlnet.htm#BIIDDACA
|
87
|
+
[SQLNET.OUTBOUND_CONNECT_TIMEOUT]: https://docs.oracle.com/database/121/NETRF/sqlnet.htm#NETRF427
|
88
|
+
[SQLNET.SEND_TIMEOUT]: http://docs.oracle.com/database/121/NETRF/sqlnet.htm#NETRF228
|
89
|
+
[SQLNET.RECV_TIMEOUT]: http://docs.oracle.com/database/121/NETRF/sqlnet.htm#NETRF227
|
90
|
+
[connect descriptor]: https://docs.oracle.com/database/121/NETRF/glossary.htm#BGBEDFBF
|
91
|
+
[EZCONNECT]: https://docs.oracle.com/database/121/NETAG/naming.htm#NETAG255
|
92
|
+
[CONNECT_TIMEOUT]: https://docs.oracle.com/database/121/NETRF/tnsnames.htm#NETRF666
|
93
|
+
[TRANSPORT_CONNECT_TIMEOUT]: https://docs.oracle.com/database/121/NETRF/tnsnames.htm#NETRF1982
|
94
|
+
[Oracle Net]: https://en.wikipedia.org/wiki/Oracle_Net_Services#Oracle_Net
|
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/apiwrap.rb
CHANGED
@@ -35,7 +35,11 @@ class FuncDef
|
|
35
35
|
ver_major = (ver / 100)
|
36
36
|
ver_minor = (ver / 10) % 10
|
37
37
|
ver_update = ver % 10
|
38
|
-
@version =
|
38
|
+
@version = if ver_major >= 18
|
39
|
+
((ver_major << 24) | (ver_minor << 16) | (ver_update << 12))
|
40
|
+
else
|
41
|
+
((ver_major << 24) | (ver_minor << 20) | (ver_update << 12))
|
42
|
+
end
|
39
43
|
case @version
|
40
44
|
when 0x08000000; @version_num = 'ORAVER_8_0'
|
41
45
|
when 0x08100000; @version_num = 'ORAVER_8_1'
|
@@ -44,6 +48,7 @@ class FuncDef
|
|
44
48
|
when 0x0a100000; @version_num = 'ORAVER_10_1'
|
45
49
|
when 0x0a200000; @version_num = 'ORAVER_10_2'
|
46
50
|
when 0x0b100000; @version_num = 'ORAVER_11_1'
|
51
|
+
when 0x12000000; @version_num = 'ORAVER_18'
|
47
52
|
end
|
48
53
|
@version_str = "#{ver_major}.#{ver_minor}.#{ver_update}"
|
49
54
|
@ret = val[:ret] || 'sword'
|