ruby-plsql 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9c79fd3f97babd3bfa0f5a54b0830a12a6510c9
4
- data.tar.gz: b3ec4ad1f9db5aa761fc751b1db9a1263c2dd6f1
3
+ metadata.gz: 64f0c78d939483e1b18a87b6bb7919188a839fca
4
+ data.tar.gz: f4f86c8a37db7eb0307fcb973b9d761a02e0b26d
5
5
  SHA512:
6
- metadata.gz: 88a0bf576dd829b0cbd7102a72a7a9d8bdfe3aee2e8771353756887f292c5c364ea9b24004c41e4cb14882cfd82c4d8ef7a9cd3709e04ab4693236dd163011c7
7
- data.tar.gz: ac9bde40f6690697c63acb443a8a9f02afa9fc1bb1670e477c09b21f6c4aa368c61326047ae8733860d337dd862efe4432fba81f3eee35d9a9affc72c60e32ff
6
+ metadata.gz: 97a210ced8901fd700c14a28afea5290208595117aa0de360f4f304522f1ae3f9df5bba65d2d84e7b93b6c579241ee0f9366489a9408b6747cf3327db711d658
7
+ data.tar.gz: f62cfdb31b08c59605af04c1b704443344a968469a748ad9d1c95e285c39c9c6eca263693778ba3da9843c3537273ab95bba982001bcfc92d04004dbd81e15b6
@@ -0,0 +1,35 @@
1
+ sudo: required
2
+
3
+ env:
4
+ global:
5
+ - ORACLE_COOKIE=sqldev
6
+ - ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
7
+ - ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
8
+ - NLS_LANG=AMERICAN_AMERICA.AL32UTF8
9
+ - ORACLE_BASE=/u01/app/oracle
10
+ - LD_LIBRARY_PATH=$ORACLE_HOME/lib
11
+ - PATH=$PATH:$ORACLE_HOME/jdbc/lib
12
+ - DATABASE_VERSION=11.2.0.2
13
+ - ORACLE_SID=XE
14
+ - DATABASE_NAME=XE
15
+ - ORA_SDTZ='Europe/London' #Needed as a client parameter
16
+ - TZ='Europe/London' #Needed as a DB Server parameter
17
+
18
+ before_install:
19
+ - chmod +x .travis/oracle/download.sh
20
+ - chmod +x .travis/oracle/install.sh
21
+ - chmod +x .travis/setup_accounts.sh
22
+
23
+ install:
24
+ - .travis/oracle/download.sh
25
+ - .travis/oracle/install.sh
26
+ - .travis/setup_accounts.sh
27
+ - bundle install
28
+
29
+ language: ruby
30
+ rvm:
31
+ - 2.3.0
32
+ - 2.2.4
33
+ - 1.9.3
34
+ - jruby-1.7.9
35
+ - jruby-9.0.5.0
@@ -0,0 +1,5 @@
1
+ Copyright (c) 2013, Christopher Bandy
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,64 @@
1
+ [![Build](https://travis-ci.org/cbandy/travis-oracle.svg?branch=master)](https://travis-ci.org/cbandy/travis-oracle)
2
+
3
+ Use [Oracle Database Express Edition][] in your builds on [Travis CI][].
4
+
5
+ [Oracle Database Express Edition]: http://www.oracle.com/technetwork/database/database-technologies/express-edition/overview/index.html
6
+ [Travis CI]: https://travis-ci.org/
7
+
8
+
9
+ Usage
10
+ -----
11
+
12
+ To use this tool, you must have an Oracle account with which you have accepted
13
+ the current license agreement for [Oracle Database Express Edition][].
14
+
15
+ 1. Add your Oracle username and password to your build [environment variables][],
16
+ either as hidden repository settings or encrypted variables:
17
+
18
+ | Variable Name | Value |
19
+ | -------------------------- | ------------- |
20
+ | `ORACLE_LOGIN_ssousername` | your username |
21
+ | `ORACLE_LOGIN_password` | your password |
22
+
23
+ 2. Add the version information to your build environment variables:
24
+
25
+ ```yaml
26
+ - ORACLE_COOKIE=sqldev
27
+ - ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
28
+ - ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
29
+ - ORACLE_SID=XE
30
+ ```
31
+
32
+ 3. Download and extract the [latest release][] into your project. For example,
33
+
34
+ ```shell
35
+ wget 'https://github.com/cbandy/travis-oracle/archive/v2.0.0.tar.gz'
36
+ mkdir -p .travis/oracle
37
+ tar xz --strip-components 1 -C .travis/oracle -f v2.0.0.tar.gz
38
+ ```
39
+
40
+ 4. Enable [`sudo`](https://docs.travis-ci.com/user/workers/standard-infrastructure/):
41
+
42
+ ```yaml
43
+ sudo: required
44
+ ```
45
+
46
+ 5. Finally, execute the extracted scripts as part of your build, usually
47
+ during [`before_install`](https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle):
48
+
49
+ ```yaml
50
+ - .travis/oracle/download.sh
51
+ - .travis/oracle/install.sh
52
+ ```
53
+
54
+ [SQL\*Plus][] is installed to `$ORACLE_HOME/bin/sqlplus`, and the current user
55
+ has both normal and DBA access without a password, i.e. `/` and `/ AS SYSDBA`.
56
+
57
+ [OCI][] and [OCCI][] libraries and header files are in `$ORACLE_HOME/lib` and
58
+ `$ORACLE_HOME/rdbms/public`, respectively.
59
+
60
+ [environment variables]: https://docs.travis-ci.com/user/environment-variables/
61
+ [latest release]: https://github.com/cbandy/travis-oracle/releases/latest
62
+ [OCCI]: http://www.oracle.com/pls/topic/lookup?ctx=xe112&id=LNCPP
63
+ [OCI]: http://www.oracle.com/pls/topic/lookup?ctx=xe112&id=LNOCI
64
+ [SQL\*Plus]: http://www.oracle.com/pls/topic/lookup?ctx=xe112&id=SQPUG
@@ -0,0 +1,100 @@
1
+ // vim: set et sw=2 ts=2:
2
+ "use strict";
3
+ var env = process.env;
4
+ var Promise = require('bluebird');
5
+ var Phantom = Promise.promisifyAll(require('node-phantom-simple'));
6
+ var PhantomError = require('node-phantom-simple/headless_error');
7
+
8
+ Phantom.createAsync({ parameters: { 'ssl-protocol': 'tlsv1' } }).then(function (browser) {
9
+ browser = Promise.promisifyAll(browser, { suffix: 'Promise' });
10
+
11
+ // Configure the browser, open a tab
12
+ return browser
13
+ .addCookiePromise({'name': 'oraclelicense', 'value': "accept-" + env['ORACLE_COOKIE'] + "-cookie", 'domain': '.oracle.com' })
14
+ .then(function () {
15
+ return browser.createPagePromise();
16
+ })
17
+ .then(function (page) {
18
+ page = Promise.promisifyAll(page, { suffix: 'Promise' });
19
+
20
+ // Configure the tab
21
+ page.onResourceError = console.error.bind(console);
22
+ return page
23
+ .setPromise('settings.userAgent', env['USER_AGENT']) // PhantomJS configures the UA per tab
24
+
25
+ // Request the file, wait for the login page
26
+ .then(function () {
27
+ return page.openPromise("https://edelivery.oracle.com/akam/otn/linux/" + env['ORACLE_FILE']).then(function (status) {
28
+ if (status != 'success') throw "Unable to connect to oracle.com";
29
+ return page.waitForSelectorPromise('input[type=password]', 5000);
30
+ })
31
+ .catch(PhantomError, function (err) {
32
+ return page.getPromise('plainText').then(function (text) {
33
+ console.error("Unable to load login page. Last response was:\n" + text);
34
+ throw err;
35
+ });
36
+ });
37
+ })
38
+
39
+ // Export cookies for cURL
40
+ .then(function () {
41
+ return page.getPromise('cookies').then(function (cookies) {
42
+ var data = "";
43
+ for (var i = 0; i < cookies.length; ++i) {
44
+ var cookie = cookies[i];
45
+ data += cookie.domain + "\tTRUE\t" + cookie.path + "\t"
46
+ + (cookie.secure ? "TRUE" : "FALSE") + "\t0\t"
47
+ + cookie.name + "\t" + cookie.value + "\n";
48
+ }
49
+ return Promise.promisifyAll(require('fs')).writeFileAsync(env['COOKIES'], data);
50
+ });
51
+ })
52
+
53
+ // Submit the login form using cURL
54
+ .then(function () {
55
+ return page.evaluatePromise(function () {
56
+ var $form = jQuery(document.forms[0]);
57
+ return {
58
+ action: $form.prop('action'),
59
+ data: $form.serialize()
60
+ };
61
+ })
62
+ .then(function (form) {
63
+ return browser.exitPromise().then(function () {
64
+ for (var key in env) {
65
+ if (key.indexOf('ORACLE_LOGIN_') == 0 && env.hasOwnProperty(key)) {
66
+ var name = key.substr(13) + '=';
67
+ form.data = form.data.replace(name, name + env[key]);
68
+ }
69
+ }
70
+
71
+ var cmd = ['curl', [
72
+ '--cookie', env['COOKIES'],
73
+ '--cookie-jar', env['COOKIES'],
74
+ '--data', '@-',
75
+ '--location',
76
+ '--output', require('path').basename(env['ORACLE_FILE']),
77
+ '--user-agent', env['USER_AGENT'],
78
+ form.action
79
+ ]];
80
+
81
+ console.info("Executing %j", cmd);
82
+
83
+ var child_process = require('child_process');
84
+ var child = child_process.spawn.apply(child_process, cmd.concat({ stdio: ['pipe', 1, 2] }));
85
+ child.on('exit', process.exit);
86
+ child.stdin.end(form.data);
87
+ });
88
+ });
89
+ })
90
+ .catch(function (err) {
91
+ console.error(err);
92
+ browser.on('exit', function () { process.exit(1); });
93
+ browser.exit();
94
+ });
95
+ });
96
+ })
97
+ .catch(function (err) {
98
+ console.error(err);
99
+ process.exit(1);
100
+ });
@@ -0,0 +1,16 @@
1
+ #!/bin/sh -e
2
+
3
+ [ -n "$ORACLE_COOKIE" ] || { echo "Missing ORACLE_COOKIE environment variable!"; exit 1; }
4
+ [ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
5
+
6
+ cd "$(dirname "$(readlink -f "$0")")"
7
+
8
+ npm install bluebird node-phantom-simple
9
+
10
+ export COOKIES='cookies.txt'
11
+ export USER_AGENT='Mozilla/5.0'
12
+
13
+ echo > "$COOKIES"
14
+ chmod 600 "$COOKIES"
15
+
16
+ exec node download.js
@@ -0,0 +1,32 @@
1
+ #!/bin/sh -e
2
+
3
+ [ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
4
+ [ -n "$ORACLE_HOME" ] || { echo "Missing ORACLE_HOME environment variable!"; exit 1; }
5
+
6
+ ORACLE_RPM="$(basename $ORACLE_FILE .zip)"
7
+
8
+ cd "$(dirname "$(readlink -f "$0")")"
9
+
10
+ sudo apt-get -qq update
11
+ sudo apt-get --no-install-recommends -qq install bc libaio1 rpm unzip
12
+
13
+ df -B1 /dev/shm | awk 'END { if ($1 != "shmfs" && $1 != "tmpfs" || $2 < 2147483648) exit 1 }' ||
14
+ ( sudo rm -r /dev/shm && sudo mkdir /dev/shm && sudo mount -t tmpfs shmfs -o size=2G /dev/shm )
15
+
16
+ test -f /sbin/chkconfig ||
17
+ ( echo '#!/bin/sh' | sudo tee /sbin/chkconfig > /dev/null && sudo chmod u+x /sbin/chkconfig )
18
+
19
+ test -d /var/lock/subsys || sudo mkdir /var/lock/subsys
20
+
21
+ unzip -j "$(basename $ORACLE_FILE)" "*/$ORACLE_RPM"
22
+ sudo rpm --install --nodeps --nopre "$ORACLE_RPM"
23
+
24
+ echo 'OS_AUTHENT_PREFIX=""' | sudo tee -a "$ORACLE_HOME/config/scripts/init.ora" > /dev/null
25
+ sudo usermod -aG dba $USER
26
+
27
+ ( echo ; echo ; echo travis ; echo travis ; echo n ) | sudo AWK='/usr/bin/awk' /etc/init.d/oracle-xe configure
28
+
29
+ "$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
30
+ CREATE USER $USER IDENTIFIED EXTERNALLY;
31
+ GRANT CONNECT, RESOURCE TO $USER;
32
+ SQL
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ set -ev
4
+
5
+ "$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
6
+ @@spec/support/unlock_and_setup_hr_user.sql
7
+ @@spec/support/create_arunit_user.sql
8
+ exit
9
+ SQL
data/Gemfile CHANGED
@@ -3,14 +3,15 @@ source 'http://rubygems.org'
3
3
  group :development do
4
4
  gem 'jeweler', '~> 2.0.1'
5
5
  gem 'rspec', '~> 3.1'
6
+ gem 'rspec_junit_formatter'
6
7
 
7
8
  unless ENV['NO_ACTIVERECORD']
8
9
  gem 'activerecord', '>= 3.2.3', '< 4.3.0'
9
- gem 'activerecord-oracle_enhanced-adapter', '>= 1.4.1', '< 1.6.0'
10
+ gem 'activerecord-oracle_enhanced-adapter', '>= 1.4.1', '< 1.7.0'
10
11
  gem 'simplecov', '>= 0'
11
12
  end
12
13
 
13
- platforms :ruby do
14
- gem 'ruby-oci8', '~> 2.1.2'
14
+ platforms :ruby, :mswin, :mingw do
15
+ gem 'ruby-oci8', '~> 2.1'
15
16
  end
16
17
  end
@@ -1,3 +1,25 @@
1
+ == 0.6.0 2016-03-13
2
+ * Improvements
3
+ * Add support for records with boolean attributes - as input and output parameters and as return values of stored procedures
4
+ * Add support for VARCHAR, SIMPLE_INTEGER+subtypes
5
+ * Accessing to package objects via #[]
6
+ * Add XMLTYPE support for procedures and functions
7
+ * New procedure argument metadata option 'defaulted'
8
+ * Use current_schema in PLSQL::Schema#schema_name
9
+ * Add support for ruby-oci8 ~> 2.1 (was ~> 2.1.2) - as ruby-oci8 2.2.x is already available
10
+ * Add support for Oracle enhanced adapter 1.6.x
11
+ * Bug fixes
12
+ * Time-zone configuration support fixes and improvements. Support for Session timezone from ENV['TZ'] removed
13
+ * Fix thread safety problem in PLSQL::OCIConnection::Cursor
14
+ * Fix: JRuby PLS_INTEGER, BINARY_INTEGER NULL value becomes 0
15
+ * Internal (development) improvements
16
+ * Travis CI setup for the project
17
+ * Allow reporting of Unit Tests on Jenkins CI with "RspecJunitFormatter"
18
+ * Vagrant box CentOS version updated to v7.2
19
+ * Unit tests setup/teardown fixes for procedure_spec
20
+ * Documentation
21
+ * Add reference to ruby-plsql cheat sheet
22
+
1
23
  == 0.5.3 2015-05-07
2
24
 
3
25
  * Improvements
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/rsim/ruby-plsql.svg?branch=master)](https://travis-ci.org/rsim/ruby-plsql)
2
+
1
3
  ruby-plsql
2
4
  ==========
3
5
 
@@ -8,7 +10,7 @@ DESCRIPTION
8
10
 
9
11
  ruby-plsql gem provides simple Ruby API for calling Oracle PL/SQL procedures. It could be used both for accessing Oracle PL/SQL API procedures in legacy applications as well as it could be used to create PL/SQL unit tests using Ruby testing libraries.
10
12
 
11
- NUMBER, BINARY_INTEGER, PLS_INTEGER, VARCHAR2, NVARCHAR2, CHAR, NCHAR, DATE, TIMESTAMP, CLOB, BLOB, BOOLEAN, PL/SQL RECORD, TABLE, VARRAY, OBJECT and CURSOR types are supported for input and output parameters and return values of PL/SQL procedures and functions.
13
+ NUMBER, BINARY_INTEGER, PLS_INTEGER, NATURAL, NATURALN, POSITIVE, POSITIVEN, SIGNTYPE, SIMPLE_INTEGER, VARCHAR, VARCHAR2, NVARCHAR2, CHAR, NCHAR, DATE, TIMESTAMP, CLOB, BLOB, BOOLEAN, PL/SQL RECORD, TABLE, VARRAY, OBJECT and CURSOR types are supported for input and output parameters and return values of PL/SQL procedures and functions.
12
14
 
13
15
  ruby-plsql supports Ruby 1.8.7, 1.9.3, 2.1.3 and JRuby 1.6.7, 1.7.16 implementations.
14
16
 
@@ -117,6 +119,11 @@ plsql.activerecord_class = ActiveRecord::Base
117
119
 
118
120
  and then you do not need to specify plsql.connection (this is also safer when ActiveRecord reestablishes connection to database).
119
121
 
122
+
123
+ ### Cheat Sheet:
124
+
125
+ You may have a look at this [Cheat Sheet](http://cheatography.com/jgebal/cheat-sheets/ruby-plsql-cheat-sheet/) for instructions on how to use ruby-plsql
126
+
120
127
  INSTALLATION
121
128
  ------------
122
129
 
@@ -138,6 +145,18 @@ If you are using JRuby then you need to download latest [Oracle JDBC driver](htt
138
145
  * in `JRUBY_HOME/lib` directory
139
146
  * or include path to JDBC driver jar file in Java `CLASSPATH`
140
147
 
148
+ Make sure to setup the following Oracle-specific environment variables properly
149
+
150
+ * [NLS_LANG](http://www.orafaq.com/wiki/NLS_LANG) - preferred value `NLS_LANG=AMERICAN_AMERICA.AL32UTF8`
151
+ * [ORA_SDTZ](http://docs.oracle.com/cd/E18283_01/server.112/e10729/ch4datetime.htm#CBBEEAFB) The setting should point a machine timezone like: `ORA_SDTZ=Europe/Riga`, otherwise Oracle by default uses a Fixed-offset timezone (like `03:00`) that is not daylight saving (DST) aware, which will lead to wrong translations of the timestamp values between Ruby code (DTS-aware) and Oracle session (non-DST-aware).
152
+ * [ORACLE_HOME](http://www.orafaq.com/wiki/ORACLE_HOME)
153
+
154
+ You may either alter your environment settings or set the values in file `spec/support/custom_config.rb`. Sample file `custom_config.rb.sample` shows how to do that.
155
+
156
+
157
+ Make sure you use correct version of Oracle client for database you're connecting to. Otherwise you may encounter TimeZone errors like [this](http://stackoverflow.com/questions/7678485/oracle-ora-01805-on-oracle-11g-database)
158
+
159
+
141
160
  TESTS
142
161
  -----
143
162
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.6.0
@@ -4,7 +4,7 @@ VAGRANTFILE_API_VERSION = "2"
4
4
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
5
5
 
6
6
  # Every Vagrant virtual environment requires a box to build off of.
7
- config.vm.box = "chef/centos-6.6"
7
+ config.vm.box = "boxcutter/centos72"
8
8
  config.vm.hostname = "vagrant.oracle"
9
9
  config.vm.network :forwarded_port, guest: 1521, host: 1521
10
10
 
@@ -23,7 +23,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
23
23
  config.vm.provision :shell, inline: "yum update -y"
24
24
  config.vm.provision :shell, inline: "yum install -y libaio bc flex unzip"
25
25
  config.vm.provision :shell, inline: "mkdir -p /opt/oracle"
26
- config.vm.provision :shell, inline: "unzip -q -d /opt/oracle /vagrant/oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
26
+ config.vm.provision :shell, inline: "unzip -o -q -d /opt/oracle /vagrant/oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
27
27
  config.vm.provision :shell, inline: "cd /opt/oracle/Disk1 && rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm"
28
28
  config.vm.provision :shell, inline: %q{sed -i -E "s/<value required>/oracle/" /opt/oracle/Disk1/response/xe.rsp}
29
29
  config.vm.provision :shell, inline: "/etc/init.d/oracle-xe configure responseFile=/opt/oracle/Disk1/response/xe.rsp >> /opt/oracle/XEsilentinstall.log"
@@ -32,7 +32,7 @@ module PLSQL
32
32
  else
33
33
  raise ArgumentError, "Unknown raw driver"
34
34
  end
35
- conn.set_time_zone(params[:time_zone])
35
+ conn.set_time_zone(params[:time_zone]||ENV['ORA_SDTZ'])
36
36
  conn
37
37
  end
38
38
 
@@ -197,9 +197,8 @@ module PLSQL
197
197
  @session_id ||= select_first("SELECT TO_NUMBER(USERENV('SESSIONID')) FROM dual")[0]
198
198
  end
199
199
 
200
- # Set time zone (default taken from TZ environment variable)
200
+ # Set time zone
201
201
  def set_time_zone(time_zone=nil)
202
- time_zone ||= ENV['TZ']
203
202
  exec("alter session set time_zone = '#{time_zone}'") if time_zone
204
203
  end
205
204
 
@@ -50,8 +50,7 @@ module PLSQL
50
50
  end
51
51
 
52
52
  def set_time_zone(time_zone=nil)
53
- time_zone ||= ENV['TZ']
54
- raw_connection.setSessionTimeZone(time_zone)
53
+ raw_connection.setSessionTimeZone(time_zone) if time_zone
55
54
  end
56
55
 
57
56
  def logoff
@@ -108,7 +107,7 @@ module PLSQL
108
107
  if metadata[:in_out] =~ /OUT/
109
108
  @out_types[arg] = type || ora_value.class
110
109
  @out_index[arg] = bind_param_index(arg)
111
- if ['TABLE','VARRAY','OBJECT'].include?(metadata[:data_type])
110
+ if ['TABLE','VARRAY','OBJECT','XMLTYPE'].include?(metadata[:data_type])
112
111
  @statement.registerOutParameter(@out_index[arg], @connection.get_java_sql_type(ora_value,type),
113
112
  metadata[:sql_type_name])
114
113
  else
@@ -278,7 +277,7 @@ module PLSQL
278
277
  when :Time, :'Java::JavaSql::Timestamp'
279
278
  stmt.send("setTimestamp#{key && "AtName"}", key || i, value)
280
279
  when :NilClass
281
- if ['TABLE', 'VARRAY', 'OBJECT'].include?(metadata[:data_type])
280
+ if ['TABLE', 'VARRAY', 'OBJECT','XMLTYPE'].include?(metadata[:data_type])
282
281
  stmt.send("setNull#{key && "AtName"}", key || i, get_java_sql_type(value, type),
283
282
  metadata[:sql_type_name])
284
283
  elsif metadata[:data_type] == 'REF CURSOR'
@@ -305,7 +304,7 @@ module PLSQL
305
304
  def get_bind_variable(stmt, i, type)
306
305
  case type.to_s.to_sym
307
306
  when :Fixnum, :Bignum, :Integer
308
- stmt.getInt(i)
307
+ stmt.getObject(i)
309
308
  when :Float
310
309
  stmt.getFloat(i)
311
310
  when :BigDecimal
@@ -343,7 +342,7 @@ module PLSQL
343
342
  def plsql_to_ruby_data_type(metadata)
344
343
  data_type, data_length = metadata[:data_type], metadata[:data_length]
345
344
  case data_type
346
- when "VARCHAR2", "CHAR", "NVARCHAR2", "NCHAR"
345
+ when "VARCHAR", "VARCHAR2", "CHAR", "NVARCHAR2", "NCHAR"
347
346
  [String, data_length || 32767]
348
347
  when "CLOB", "NCLOB"
349
348
  [Java::OracleSql::CLOB, nil]
@@ -351,7 +350,7 @@ module PLSQL
351
350
  [Java::OracleSql::BLOB, nil]
352
351
  when "NUMBER"
353
352
  [BigDecimal, nil]
354
- when "PLS_INTEGER", "BINARY_INTEGER"
353
+ when "NATURAL", "NATURALN", "POSITIVE", "POSITIVEN", "SIGNTYPE", "SIMPLE_INTEGER", "PLS_INTEGER", "BINARY_INTEGER"
355
354
  [Fixnum, nil]
356
355
  when "DATE"
357
356
  [DateTime, nil]