ruby-oci8 2.2.10-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +14 -0
  3. data/COPYING +30 -0
  4. data/COPYING_old +64 -0
  5. data/ChangeLog +3826 -0
  6. data/Makefile +92 -0
  7. data/NEWS +1209 -0
  8. data/README.md +66 -0
  9. data/dist-files +112 -0
  10. data/docs/bind-array-to-in_cond.md +38 -0
  11. data/docs/conflicts-local-connections-and-processes.md +98 -0
  12. data/docs/hanging-after-inactivity.md +63 -0
  13. data/docs/install-binary-package.md +44 -0
  14. data/docs/install-full-client.md +111 -0
  15. data/docs/install-instant-client.md +194 -0
  16. data/docs/install-on-osx.md +46 -0
  17. data/docs/ldap-auth-and-function-interposition.md +123 -0
  18. data/docs/number-type-mapping.md +79 -0
  19. data/docs/platform-specific-issues.md +164 -0
  20. data/docs/report-installation-issue.md +50 -0
  21. data/docs/timeout-parameters.md +94 -0
  22. data/lib/.document +1 -0
  23. data/lib/dbd/OCI8.rb +591 -0
  24. data/lib/oci8/.document +8 -0
  25. data/lib/oci8/bindtype.rb +333 -0
  26. data/lib/oci8/check_load_error.rb +146 -0
  27. data/lib/oci8/compat.rb +117 -0
  28. data/lib/oci8/connection_pool.rb +179 -0
  29. data/lib/oci8/cursor.rb +605 -0
  30. data/lib/oci8/datetime.rb +605 -0
  31. data/lib/oci8/encoding-init.rb +45 -0
  32. data/lib/oci8/encoding.yml +537 -0
  33. data/lib/oci8/metadata.rb +2148 -0
  34. data/lib/oci8/object.rb +641 -0
  35. data/lib/oci8/oci8.rb +756 -0
  36. data/lib/oci8/ocihandle.rb +591 -0
  37. data/lib/oci8/oracle_version.rb +153 -0
  38. data/lib/oci8/properties.rb +196 -0
  39. data/lib/oci8/version.rb +3 -0
  40. data/lib/oci8.rb +190 -0
  41. data/lib/oci8lib_310.so +0 -0
  42. data/lib/ruby-oci8.rb +1 -0
  43. data/metaconfig +142 -0
  44. data/pre-distclean.rb +7 -0
  45. data/ruby-oci8.gemspec +85 -0
  46. data/setup.rb +1342 -0
  47. data/test/README.md +37 -0
  48. data/test/config.rb +201 -0
  49. data/test/setup_test_object.sql +199 -0
  50. data/test/setup_test_package.sql +59 -0
  51. data/test/test_all.rb +56 -0
  52. data/test/test_appinfo.rb +62 -0
  53. data/test/test_array_dml.rb +332 -0
  54. data/test/test_bind_array.rb +70 -0
  55. data/test/test_bind_boolean.rb +99 -0
  56. data/test/test_bind_integer.rb +47 -0
  57. data/test/test_bind_raw.rb +45 -0
  58. data/test/test_bind_string.rb +105 -0
  59. data/test/test_bind_time.rb +177 -0
  60. data/test/test_break.rb +125 -0
  61. data/test/test_clob.rb +85 -0
  62. data/test/test_connection_pool.rb +124 -0
  63. data/test/test_connstr.rb +220 -0
  64. data/test/test_datetime.rb +585 -0
  65. data/test/test_dbi.rb +365 -0
  66. data/test/test_dbi_clob.rb +53 -0
  67. data/test/test_encoding.rb +103 -0
  68. data/test/test_error.rb +87 -0
  69. data/test/test_metadata.rb +2674 -0
  70. data/test/test_object.rb +546 -0
  71. data/test/test_oci8.rb +624 -0
  72. data/test/test_oracle_version.rb +68 -0
  73. data/test/test_oradate.rb +255 -0
  74. data/test/test_oranumber.rb +792 -0
  75. data/test/test_package_type.rb +981 -0
  76. data/test/test_properties.rb +17 -0
  77. data/test/test_rowid.rb +32 -0
  78. metadata +123 -0
@@ -0,0 +1,194 @@
1
+ # @title Install for Oracle Instant Client
2
+
3
+ Install for Oracle Instant Client
4
+ =================================
5
+
6
+ Introduction
7
+ ------------
8
+
9
+ This page explains the way to install ruby-oci8 for Oracle Instant Client.
10
+
11
+ Look at {file:docs/install-full-client.md} for Oracle Full Client.
12
+
13
+ Look at {file:docs/install-binary-package.md} for Windows unless you
14
+ have a special need to compile ruby-oci8 by yourself.
15
+
16
+ Look at {file:docs/install-on-osx.md} for OS X.
17
+
18
+ Install Oracle Instant Client Packages
19
+ --------------------------------------
20
+
21
+ ### Download Instant Client Packages
22
+
23
+ Download the following packages from [Oracle Technology Network](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html).
24
+
25
+ * Instant Client Package - Basic or Basic Lite
26
+ * Instant Client Package - SDK
27
+ * Instant Client Package - SQL*Plus
28
+
29
+ Note: use 32-bit packages for 32-bit ruby even though the OS is 64-bit.
30
+
31
+ ### UNIX zip packages
32
+
33
+ Unzip the packages as follows:
34
+
35
+ mkdir /opt
36
+ mkdir /opt/oracle
37
+ cd /opt/oracle
38
+ unzip path/to/instantclient-basic-OS-VERSION.zip
39
+ unzip path/to/instantclient-sdk-OS-VERSION.zip
40
+ unzip path/to/instantclient-sqlplus-OS-VERSION.zip
41
+
42
+ If /opt/oracle/instantclient12_1/libclntsh.so is not found, make
43
+ a symbolic link to link the library.
44
+
45
+ cd /opt/oracle/instantclient12_1
46
+ ln -s libclntsh.so.12.1 libclntsh.so
47
+
48
+ Note:
49
+
50
+ * use libclntsh.sl instead of libclntsh.so on HP-UX PA-RISC.
51
+ * skip this step for AIX.
52
+ * run `yum install libaio` also on Redhat.
53
+ * run `apt-get install libaio1` also on Ubuntu.
54
+
55
+ Set the library search path, whose name depends on the OS, to point to
56
+ the installed directory.
57
+
58
+ <table style="border: 1px #E3E3E3 solid; border-collapse: collapse; border-spacing: 0;">
59
+ <thead>
60
+ <tr><th> OS </th><th> library search path </th></tr>
61
+ </thead>
62
+ <tbody>
63
+ <tr><td> Linux </td><td> LD_LIBRARY_PATH </td></tr>
64
+ <tr><td> Solaris 32-bit ruby </td><td> LD_LIBRARY_PATH_32 or LD_LIBRARY_PATH </td></tr>
65
+ <tr><td> Solaris 64-bit ruby </td><td> LD_LIBRARY_PATH_64 or LD_LIBRARY_PATH </td></tr>
66
+ <tr><td> HP-UX PA-RISC 32-bit ruby </td><td> SHLIB_PATH </td></tr>
67
+ <tr><td> HP-UX PA-RISC 64-bit ruby </td><td> LD_LIBRARY_PATH </td></tr>
68
+ <tr><td> HP-UX IA64 </td><td> LD_LIBRARY_PATH </td></tr>
69
+ <tr><td> AIX </td><td> LIBPATH </td></tr>
70
+ </tbody>
71
+ </table>
72
+ Note: Look at {file:docs/install-on-osx.md} for OS X.
73
+
74
+ For example:
75
+
76
+ $ LD_LIBRARY_PATH=/opt/oracle/instantclient_12_1
77
+ $ export LD_LIBRARY_PATH
78
+
79
+ Though many instant client pages indicate that the environment varialbe
80
+ `ORACLE_HOME` should be set, it isn't necessary unless Oracle Net
81
+ configuration files such as `tnsnames.ora` and `sqlnet.ora` are in
82
+ `$ORACLE_HOME/network/admin/`.
83
+
84
+ ### Linux rpm packages
85
+
86
+ Install the downloaded packages as follows:
87
+
88
+ rpm -i path/to/oracle-instantclient-basic-VERSION-ARCH.rpm
89
+ rpm -i path/to/oracle-instantclient-devel-VERSION-ARCH.rpm
90
+ rpm -i path/to/oracle-instantclient-sqlplus-VERSION-ARCH.rpm
91
+
92
+ Set LD_LIBRARY_PATH to point to the directory where libclntsh.so is installed.
93
+
94
+ For example:
95
+
96
+ $ LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client/lib
97
+ $ export LD_LIBRARY_PATH
98
+
99
+ ### Windows
100
+
101
+ Unzip the packages and set `PATH` to point to the directory where `OCI.DLL` is installed.
102
+
103
+ If `require "ruby-oci8"` raises a load error such as "OCI.DLL: 126(The
104
+ specified module could not be found. )", either `OCI.DLL` or a DLL depended
105
+ by `OCI.DLL` could not be found in `PATH`.
106
+
107
+ If `OCI.DLL` is surely in `PATH`, the missing module is a Visual C++ runtime
108
+ library in most cases. You need to install "Microsoft Visual C++ Redistributable
109
+ Package" or copy a runtime library to the directory where `ruby.exe` resides.
110
+
111
+ | Oracle Version | Package | Runtime Library|
112
+ |---|---|---|
113
+ | 18.3 | [Microsoft Visual C++ 2013 Redistributable Package][2013] | MSVCR120.DLL |
114
+ | 12.2.0.x | [Microsoft Visual C++ 2013 Redistributable Package][2013] | MSVCR120.DLL |
115
+ | 12.1.0.x | [Microsoft Visual C++ 2010 Redistributable Package][2010] | MSVCR100.DLL |
116
+ | 11.2.0.x | Microsoft Visual C++ 2005 SP1 Redistributable Package ([x86][2005SP1_x86], [x64][2005SP1_x64]) | MSVCR80.DLL(The file version must be 8.0.50727.762.) |
117
+ | 11.1.0.x | [No separate redistributable package][2003] | MSVCR71.DLL |
118
+ | 10.2.0.x | [No separate redistributable package][2003] | MSVCR71.DLL |
119
+
120
+ [2013]: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
121
+ [2010]: http://www.microsoft.com/en-us/download/details.aspx?id=26999
122
+ [2005SP1_x86]: https://www.microsoft.com/en-us/download/details.aspx?id=5638
123
+ [2005SP1_x64]: https://www.microsoft.com/en-us/download/details.aspx?id=18471
124
+ [2003]: http://stackoverflow.com/questions/1596167/where-to-download-microsoft-visual-c-2003-redistributable#6132093
125
+
126
+ Check the environment
127
+ ---------------------
128
+
129
+ ### Oracle installation
130
+
131
+ Run the following command and confirm it works fine. If it doesn't
132
+ work well, check `LD_LIBRARY_PATH` or PATH.
133
+
134
+ sqlplus USERNAME/PASSWORD
135
+
136
+ ### ruby installation
137
+
138
+ Run the following command. If it ends with "can't find header files
139
+ for ruby" or "ruby: no such file to load -- mkmf (LoadError)", you need
140
+ to install ruby-devel(redhat) or ruby-dev(debian/ubuntu).
141
+
142
+ ruby -r mkmf -e ""
143
+
144
+ ### development tools
145
+
146
+ You need a C compiler and development tools such as make or nmake.
147
+ Note that they must be same with ones used to compile the ruby.
148
+ For example, you need Oracle Solaris Studio, not gcc, for ruby
149
+ compiled by Oracle Solaris Studio.
150
+
151
+ Installation
152
+ ------------
153
+
154
+ If you get a problem in the following steps, look at {file:docs/platform-specific-issues.md}
155
+ and {file:docs/report-installation-issue.md}.
156
+
157
+ ### gem package
158
+
159
+ Run the following command.
160
+
161
+ gem install ruby-oci8
162
+
163
+ If you get a problem, look at {file:docs/platform-specific-issues.md}
164
+ and {file:docs/report-installation-issue.md}.
165
+
166
+ ### tar.gz package
167
+
168
+ #### Download the source code
169
+
170
+ Download the latest tar.gz package from [download page][].
171
+
172
+ Note: if you are using Windows and you have no special need to compile
173
+ it by yourself, look at {file:docs/install-binary-packge.md}.
174
+
175
+ #### Run make and install
176
+
177
+ ##### UNIX or Windows(mingw32, cygwin)
178
+
179
+ gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
180
+ cd ruby-oci8-VERSION
181
+ make
182
+ make install
183
+
184
+ note: If you use '`sudo`', use it only when running '`make install`'.
185
+ '`sudo`' doesn't pass library search path to the executing command for security reasons.
186
+
187
+ ##### Windows(mswin32)
188
+
189
+ gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
190
+ cd ruby-oci8-VERSION
191
+ nmake
192
+ nmake install
193
+
194
+ [download page]: https://bintray.com/kubo/generic/ruby-oci8
@@ -0,0 +1,46 @@
1
+ # @title Install ruby-oci8 on macOS
2
+
3
+ Install ruby-oci8 on macOS
4
+ =========================
5
+
6
+ **Note: Ruby-oci8 doesn't run on Apple Silicon because Oracle instant client
7
+ for Apple Silicon has not been released yet.**
8
+
9
+ Prerequisite
10
+ ------------
11
+
12
+ * Command line tools for Xcode or Xcode (by executing `xcode-select --install`) or [Xcode]
13
+
14
+ Install Oracle Instant Client Packages
15
+ --------------------------------------
16
+
17
+ If you have installed [Homebrew], use the following command:
18
+
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
+ ```
25
+
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.
29
+
30
+ ```shell
31
+ export OCI_DIR=$HOME/Downloads/instantclient_19_8 # for example
32
+ ```
33
+
34
+ Install ruby-oci8
35
+ -----------------
36
+
37
+ Note that `/usr/bin/ruby` isn't available. You need to use [`rbenv`] or so.
38
+
39
+ ```shell
40
+ $ gem install ruby-oci8
41
+ ```
42
+
43
+ [Homebrew]: http://brew.sh/
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
@@ -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
@@ -0,0 +1,164 @@
1
+ # @title Platform Specific Issues
2
+
3
+ Platform Specific Issues
4
+ ========================
5
+
6
+ Linux
7
+ -----
8
+
9
+ ### Ubuntu 11.10 (Oneiric Ocelot)
10
+
11
+ If the following error occurs even though libc6-dev is installed,
12
+
13
+ Do you install glibc-devel(redhat) or libc6-dev(debian)?
14
+ You need /usr/include/sys/types.h to compile ruby-oci8.
15
+
16
+ You need to use ruby-oci8 2.1.0 or upper. Otherwise, run the following command and re-install ruby-oci8.
17
+
18
+ $ sudo ln -s /usr/include/linux/ /usr/include/sys
19
+
20
+ ### General Linux
21
+
22
+ Use the same bit-width of libraries with ruby. For example, x86\_64
23
+ instant client for x86\_64 ruby and 32-bit instant client for 32-bit
24
+ ruby. It depends on the ruby but not on the OS. As for full client,
25
+ x86\_64 ruby cannot use with 32-bit full client, but 32-bit ruby can
26
+ use with 64-bit full client because 32-bit libraries are in
27
+ $ORACLE\_HOME/lib32.
28
+
29
+ To check which type of ruby do you use:
30
+
31
+ file `which ruby`
32
+
33
+ Note: "`" is a back quote.
34
+
35
+ Mac OS X
36
+ --------
37
+
38
+ ### OS X 10.7+
39
+
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
+
42
+ ### Intel Mac (64-bit)
43
+
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/).
45
+ Note that setting the environment variable RC\_ARCHS=x86\_64 instead of ARCHFLAGS="-arch x86\_64" will work fine also.
46
+
47
+ ### Intel Mac (32-bit)
48
+
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.
50
+
51
+ The Intel Instant client is for Mac OS X 10.5 Leopard. If you are using 10.4 Tiger,
52
+ use one of the following workarounds.
53
+
54
+ * compile ruby as ppc. (look at [How to setup Ruby and Oracle client on Intel Mac](http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/))
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/)).
56
+ * use JRuby and Oracle JDBC driver.
57
+
58
+ ### PowerPC Mac
59
+
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.
61
+
62
+ Solaris
63
+ -------
64
+
65
+ You need a same compiler which is used to make ruby itself.
66
+ For example, if the ruby is compiled by gcc, you need gcc. If it is compiled by Oracle Solaris Studio
67
+ (formerly called as Sun Studio), you need Oracle Solaris Studio.
68
+
69
+ If you use Blastwave.org's ruby and want not to install Sun Studio,
70
+ you can edit rbconfig.rb by your self. [(look at here)](http://forum.textdrive.com/viewtopic.php?id=12630)
71
+
72
+ If you use Sunfreeware.com's ruby and
73
+
74
+ $ ruby -r rbconfig -e "p Config::CONFIG['GNU_LD']"
75
+
76
+ prints "yes", you may need to edit rbconfig.rb distributed with the ruby
77
+ as follows:
78
+
79
+ from: CONFIG["LDFLAGS"] = "-L. -Wl,-E"
80
+ to: CONFIG["LDFLAGS"] = "-L. "
81
+
82
+ FreeBSD
83
+ -------
84
+
85
+ Oracle8-client port isn't available because it is too old.
86
+ You need to use linux emulator.
87
+
88
+ I have not run ruby-oci8 on linux emulator, but I guess it will
89
+ run as follows. If it works, please tell me.
90
+
91
+ If FreeBSD has a cross-compiler which can generate linux binaries,
92
+ use it to compile ruby and ruby-oci8.
93
+
94
+ If FreeBSD doesn't have such a compiler, install a linux distribution
95
+ which FreeBSD can emulate to a PC machine, make ruby and ruby-oci8 in
96
+ the linux box and copy them to the FreeBSD box as follows.
97
+
98
+ On linux:
99
+
100
+ # make ruby
101
+ tar xvfz ruby-1.8.x.tar.gz
102
+ cd ruby-1.8.x
103
+ ./configure --prefix=/usr/local/ruby-1.8.x --enable-pthread
104
+ make
105
+ make install
106
+ # setup instant client
107
+ ....
108
+ # make ruby-oci8
109
+ PATH=/usr/local/ruby-1.8.x/bin:$PATH
110
+ tar xvfz ruby-oci8-1.0.x.tar.gz
111
+ cd ruby-oci8-1.0.x
112
+ make
113
+ make install
114
+ cd /usr/local/
115
+ tar cvfz ruby-1.8.x-linux.tar.gz ruby-1.8.x
116
+
117
+ Copy ruby-1.8.x-linux.tar.gz to the FreeBSD box.
118
+
119
+ On freebsd:
120
+
121
+ cd /compat/linux/usr/local
122
+ tar xvfz ruby-1.8.x-linux.tar.gz
123
+
124
+ HP-UX
125
+ -----
126
+
127
+ You need a ruby which is linked with ''libpthread'' and ''libcl''.
128
+
129
+ Run `configure`.
130
+
131
+ tar xvfz ruby-1.9.x.tar.gz
132
+ cd ruby-1.9.x
133
+ ./configure
134
+
135
+ Then open `Makefile` to add '-lpthread -lcl' to `LIBS` and run `make`
136
+ and `make install`.
137
+
138
+ make
139
+ make install
140
+
141
+ The rest steps are described at {file:docs/install-full-client.md}.
142
+
143
+ Windows
144
+ -------
145
+
146
+ On some machines using a slow disk, you may get the following error.
147
+
148
+ Permission denied - conftest.exe
149
+
150
+ Edit mkmf.rb for a workaround.
151
+
152
+ def try_run(src, opt="")
153
+ if try_link0(src, opt)
154
+ xsystem("./conftest")
155
+ else
156
+ nil
157
+ end
158
+ ensure
159
+ # add the following one line.
160
+ sleep 1 if /mswin32|cygwin|mingw32|bccwin32/ =~ RUBY_PLATFORM
161
+ rm_f "conftest*"
162
+ end
163
+
164
+ See also: {http://abstractplain.net/blog/?p=788}.
@@ -0,0 +1,50 @@
1
+ # @title Report Installation Issues
2
+
3
+ Report Installation Issues
4
+ ==========================
5
+
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.
7
+
8
+ If it is a new one, post the following information to [github][].
9
+
10
+ [github]: https://github.com/kubo/ruby-oci8/issues
11
+
12
+ * Messages printed out to the console
13
+
14
+ * `gem_make.out` if you install a gem
15
+
16
+ * Last 100 lines of 'ext/oci8/mkmf.log'
17
+
18
+ Get them as follows.
19
+
20
+ tail -100 ext/oci8/mkmf.log
21
+
22
+ * The results of the following commands:
23
+
24
+ file `which ruby`
25
+ ruby --version
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']"
34
+
35
+ # if you use gcc,
36
+ gcc --print-prog-name=ld
37
+ gcc --print-prog-name=as
38
+
39
+ # Oracle full client
40
+ file $ORACLE_HOME/bin/oracle
41
+
42
+ # Oracle Instant client. You need to change INSTANT_CLIENT_DIRECTORY.
43
+ file INSTANT_CLIENT_DIRECTORY/libclntsh.*
44
+
45
+ echo $LD_LIBRARY_PATH
46
+ echo $LIBPATH # AIX
47
+ echo $SHLIB_PATH # HP-UX PA-RISC 32-bit ruby
48
+ echo $DYLD_LIBRARY_PATH # Mac OS X
49
+ echo $LD_LIBRARY_PATH_32 # Solaris 32-bit ruby
50
+ echo $LD_LIBRARY_PATH_64 # Solaris 64-bit ruby