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.
data/ext/oci8/stmt.c CHANGED
@@ -78,7 +78,7 @@ static VALUE oci8_stmt_initialize(VALUE self, VALUE svc, VALUE sql)
78
78
  if (!NIL_P(sql)) {
79
79
  OCI8SafeStringValue(sql);
80
80
 
81
- rv = OCIStmtPrepare2(svcctx->base.hp.svc, &stmt->base.hp.stmt, oci8_errhp, RSTRING_ORATEXT(sql), RSTRING_LEN(sql), NULL, 0, OCI_NTV_SYNTAX, OCI_DEFAULT);
81
+ rv = OCIStmtPrepare2(svcctx->base.hp.svc, &stmt->base.hp.stmt, oci8_errhp, RSTRING_ORATEXT(sql), RSTRING_LENINT(sql), NULL, 0, OCI_NTV_SYNTAX, OCI_DEFAULT);
82
82
  if (IS_OCI_ERROR(rv)) {
83
83
  chker2(rv, &svcctx->base);
84
84
  }
@@ -178,10 +178,10 @@ static VALUE oci8_bind(VALUE self, VALUE vplaceholder, VALUE vbindobj)
178
178
  */
179
179
  VALUE symval = rb_sym2str(vplaceholder);
180
180
  const char *symname = RSTRING_PTR(symval);
181
- size_t len = RSTRING_LEN(symval);
181
+ ub4 len = RSTRING_LENINT(symval);
182
182
  #else
183
183
  const char *symname = rb_id2name(SYM2ID(vplaceholder));
184
- size_t len = strlen(symname);
184
+ ub4 len = (ub4)strlen(symname);
185
185
  #endif
186
186
  placeholder_ptr = ALLOCA_N(char, len + 1);
187
187
  placeholder_len = len + 1;
@@ -192,7 +192,7 @@ static VALUE oci8_bind(VALUE self, VALUE vplaceholder, VALUE vbindobj)
192
192
  } else {
193
193
  OCI8StringValue(vplaceholder);
194
194
  placeholder_ptr = RSTRING_PTR(vplaceholder);
195
- placeholder_len = RSTRING_LEN(vplaceholder);
195
+ placeholder_len = RSTRING_LENINT(vplaceholder);
196
196
  }
197
197
  obind = TO_BIND(vbindobj); /* 2 */
198
198
  if (obind->base.hp.bnd != NULL) {
data/ext/oci8/win32.c CHANGED
@@ -26,8 +26,9 @@ typedef struct {
26
26
  HKEY hSubKey;
27
27
  } enum_homes_arg_t;
28
28
 
29
- static VALUE enum_homes_real(enum_homes_arg_t *arg)
29
+ static VALUE enum_homes_real(VALUE varg)
30
30
  {
31
+ enum_homes_arg_t *arg = (enum_homes_arg_t *)varg;
31
32
  LONG rv;
32
33
  DWORD type;
33
34
  DWORD idx;
@@ -77,8 +78,9 @@ static VALUE enum_homes_real(enum_homes_arg_t *arg)
77
78
  return Qnil;
78
79
  }
79
80
 
80
- static VALUE enum_homes_ensure(enum_homes_arg_t *arg)
81
+ static VALUE enum_homes_ensure(VALUE varg)
81
82
  {
83
+ enum_homes_arg_t *arg = (enum_homes_arg_t *)varg;
82
84
  if (arg->hKey != NULL) {
83
85
  RegCloseKey(arg->hKey);
84
86
  arg->hKey = NULL;
@@ -4,7 +4,7 @@ class OCI8
4
4
  module Util
5
5
 
6
6
  case RUBY_PLATFORM
7
- when /mswin32|cygwin|mingw32|bccwin32/
7
+ when /mswin32|cygwin|mingw/
8
8
 
9
9
  require 'fiddle/import'
10
10
  require 'fiddle/types'
data/lib/oci8/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class OCI8
2
- VERSION = "2.2.7"
2
+ VERSION = "2.2.11"
3
3
  end
data/lib/oci8.rb CHANGED
@@ -11,8 +11,11 @@ if RUBY_PLATFORM =~ /cygwin/
11
11
  # Cygwin manages environment variables by itself.
12
12
  # They don't synchroize with Win32's ones.
13
13
  # This set some Oracle's environment variables to win32's enviroment.
14
- require 'Win32API'
15
- win32setenv = Win32API.new('Kernel32.dll', 'SetEnvironmentVariableA', 'PP', 'I')
14
+ require 'fiddle'
15
+ win32setenv = Fiddle::Function.new( Fiddle.dlopen('Kernel32.dll')['SetEnvironmentVariableA'],
16
+ [Fiddle::TYPE_VOIDP,Fiddle::TYPE_VOIDP],
17
+ Fiddle::TYPE_INT )
18
+
16
19
  ['NLS_LANG', 'TNS_ADMIN', 'LOCAL'].each do |name|
17
20
  val = ENV[name]
18
21
  win32setenv.call(name, val && val.dup)
@@ -63,6 +66,8 @@ when 'rbx'
63
66
  so_basename += 'rbx'
64
67
  when 'jruby'
65
68
  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."
69
+ when 'truffleruby'
70
+ so_basename += 'truffleruby'
66
71
  else
67
72
  raise 'unsupported ruby engine: ' + RUBY_ENGINE
68
73
  end
@@ -105,7 +110,7 @@ end
105
110
 
106
111
  begin
107
112
  require so_basename
108
- rescue LoadError, OCIError
113
+ rescue LoadError
109
114
  require 'oci8/check_load_error'
110
115
  OCI8::Util::check_load_error($!)
111
116
  raise
data/ruby-oci8.gemspec CHANGED
@@ -50,7 +50,7 @@ EOS
50
50
  # add map files to analyze a core (minidump) file.
51
51
  so_vers.each do |ver|
52
52
  map_file = 'ext/oci8/oci8lib_#{ver}.map'
53
- so_files << map_file if File.exists? map_file
53
+ so_files << map_file if File.exist? map_file
54
54
  end
55
55
 
56
56
  # least version in so_vers
data/setup.rb CHANGED
@@ -189,7 +189,16 @@ class ConfigTable
189
189
  'the make program to compile ruby extentions' ] ],
190
190
  [ 'without-ext', [ 'no',
191
191
  'yes/no',
192
- 'does not compile/install ruby extentions' ] ]
192
+ 'does not compile/install ruby extentions' ] ],
193
+ [ 'with-instant-client-dir', ['',
194
+ 'path',
195
+ 'path to the Oracle instant client directory'] ],
196
+ [ 'with-instant-client-lib', ['',
197
+ 'path',
198
+ 'path to the Oracle instant client libraries'] ],
199
+ [ 'with-instant-client-include', ['',
200
+ 'path',
201
+ 'path to the Oracle instant client header files'] ]
193
202
  ]
194
203
  multipackage_descripters = [
195
204
  [ 'with', [ '',
@@ -277,7 +286,7 @@ class ConfigTable
277
286
 
278
287
  def initialize_from_table
279
288
  @table = {}
280
- DESCRIPTER.each do |k, (default, vname, desc, default2)|
289
+ DESCRIPTER.each do |k, (default, *)|
281
290
  @table[k] = default
282
291
  end
283
292
  end
data/test/README.md CHANGED
@@ -7,12 +7,8 @@ Before running unit test:
7
7
  ```
8
8
  2. Create user ruby
9
9
  ```sql
10
- SQL> CREATE USER ruby IDENTIFIED BY oci8;
11
- ```
12
- or
13
- ```sql
14
- SQL> CREATE USER ruby IDENTIFIED BY oci8
15
- 2 DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
10
+ SQL> CREATE USER ruby IDENTIFIED BY oci8 DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
11
+ SQL> alter user ruby quota unlimited on users;
16
12
  ```
17
13
  3. Grant the privilege to connect and execute.
18
14
  ```sql
@@ -27,6 +23,7 @@ Before running unit test:
27
23
  5. Create object types
28
24
  ```sql
29
25
  SQL> @test/setup_test_object.sql
26
+ SQL> @test/setup_test_package.sql
30
27
  ```
31
28
  6. change $dbname in test/config.rb.
32
29
 
data/test/test_break.rb CHANGED
@@ -22,9 +22,8 @@ class TestBreak < Minitest::Test
22
22
  @@server_is_runing_on_windows = nil
23
23
  def server_is_runing_on_windows?
24
24
  if @@server_is_runing_on_windows.nil?
25
- @@server_is_runing_on_windows = false
26
- @conn.exec('select banner from v$version') do |row|
27
- @@server_is_runing_on_windows = true if row[0].include? 'Windows'
25
+ @conn.exec('select dbms_utility.port_string from dual') do |row|
26
+ @@server_is_runing_on_windows = row[0].include? '/WIN'
28
27
  end
29
28
  end
30
29
  @@server_is_runing_on_windows
@@ -63,7 +62,7 @@ class TestBreak < Minitest::Test
63
62
  expect = []
64
63
  expect[PLSQL_DONE] = TIME_IN_PLSQL
65
64
  expect[OCIBREAK] = "Invalid status"
66
- if defined? Rubinius and Rubinius::VERSION >= "2.0"
65
+ if (defined? Rubinius and Rubinius::VERSION >= "2.0") || (defined? RUBY_ENGINE and RUBY_ENGINE == "truffleruby")
67
66
  # Rubinius 2.0.0.
68
67
  # DBMS_LOCK.SLEEP blocks ruby threads which try to call C-API.
69
68
  expect[SEND_BREAK] = TIME_TO_BREAK
@@ -100,6 +99,11 @@ class TestBreak < Minitest::Test
100
99
  def test_timeout
101
100
  @conn.non_blocking = true
102
101
  start_time = Time.now
102
+ if server_is_runing_on_windows?
103
+ end_time = start_time + 5
104
+ else
105
+ end_time = start_time + 1
106
+ end
103
107
 
104
108
  if defined? Rubinius and Rubinius::VERSION < "2.0"
105
109
  # Rubinius 1.2.4
@@ -113,12 +117,8 @@ class TestBreak < Minitest::Test
113
117
  @conn.exec("BEGIN DBMS_LOCK.SLEEP(5); END;")
114
118
  end
115
119
  end
116
- if server_is_runing_on_windows?
117
- end_time = start_time + 5
118
- else
119
- end_time = start_time + 1
120
- end
121
120
  assert_in_delta(Time.now, end_time, 1)
121
+ sleep(0.01) # for truffleruby. Is truffleruby too fast?
122
122
  @conn.exec("BEGIN NULL; END;")
123
123
  assert_in_delta(Time.now, end_time, 1)
124
124
  end
@@ -1,6 +1,5 @@
1
1
  require 'oci8'
2
2
  require File.dirname(__FILE__) + '/config'
3
- require 'scanf'
4
3
 
5
4
  class TestDateTime < Minitest::Test
6
5
 
@@ -28,6 +27,12 @@ class TestDateTime < Minitest::Test
28
27
  convert_to_datetime($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, subsec, $8)
29
28
  end
30
29
 
30
+ # 'YYYY-MM-DD HH24:MI:SS' or 'YYYY-MM-DD HH24:MI:SS.FF6' to array
31
+ def string_to_array(str)
32
+ /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)(?:\.(\d+))?/ =~ str
33
+ [$1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, $7 ? $7.to_i / 1000 : 0]
34
+ end
35
+
31
36
  def setup
32
37
  @conn = get_oci8_connection
33
38
  end
@@ -43,7 +48,7 @@ class TestDateTime < Minitest::Test
43
48
  @conn.exec(<<-EOS) do |row|
44
49
  SELECT TO_DATE('#{date}', 'YYYY-MM-DD HH24:MI:SS') FROM dual
45
50
  EOS
46
- assert_equal(Time.local(*date.scanf("%d-%d-%d %d:%d:%d.%06d")), row[0])
51
+ assert_equal(Time.local(*string_to_array(date)), row[0])
47
52
  end
48
53
  end
49
54
  end
@@ -94,7 +99,7 @@ EOS
94
99
  @conn.exec(<<-EOS) do |row|
95
100
  SELECT TO_TIMESTAMP('#{date}', 'YYYY-MM-DD HH24:MI:SS.FF') FROM dual
96
101
  EOS
97
- assert_equal(Time.local(*date.scanf("%d-%d-%d %d:%d:%d.%06d")), row[0])
102
+ assert_equal(Time.local(*string_to_array(date)), row[0])
98
103
  end
99
104
  end
100
105
  end
@@ -215,9 +215,15 @@ EOS
215
215
  end
216
216
 
217
217
  def test_yaml
218
+ # Use the permitted_classes keyword parameter if it is supported by YAML.load
219
+ keyword_params = if YAML.method(:load).parameters.any? { |key, value| value == :permitted_symbols }
220
+ {permitted_classes: [OraNumber]}
221
+ else
222
+ {}
223
+ end
218
224
  (LARGE_RANGE_VALUES + ['~', '-~']).each do |x|
219
225
  n = OraNumber.new(x)
220
- assert_equal(n, YAML.load(YAML.dump(n)))
226
+ assert_equal(n, YAML.load(YAML.dump(n), **keyword_params))
221
227
  end
222
228
  end
223
229
 
metadata CHANGED
@@ -1,35 +1,27 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby-oci8
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 2
7
- - 2
8
- - 7
9
- version: 2.2.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.11
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Kubo Takehiro
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2019-01-06 00:00:00 +09:00
18
- default_executable:
11
+ date: 2022-02-22 00:00:00.000000000 Z
19
12
  dependencies: []
13
+ description: 'ruby-oci8 is a ruby interface for Oracle using OCI8 API. It is available
14
+ with Oracle 10g or later including Oracle Instant Client.
20
15
 
21
- description: |
22
- ruby-oci8 is a ruby interface for Oracle using OCI8 API. It is available with Oracle 10g or later including Oracle Instant Client.
23
-
16
+ '
24
17
  email: kubo@jiubao.org
25
18
  executables: []
26
-
27
- extensions:
19
+ extensions:
28
20
  - ext/oci8/extconf.rb
29
- extra_rdoc_files:
21
+ extra_rdoc_files:
30
22
  - README.md
31
- files:
32
- - .yardopts
23
+ files:
24
+ - ".yardopts"
33
25
  - COPYING
34
26
  - COPYING_old
35
27
  - ChangeLog
@@ -37,10 +29,6 @@ files:
37
29
  - NEWS
38
30
  - README.md
39
31
  - dist-files
40
- - metaconfig
41
- - pre-distclean.rb
42
- - ruby-oci8.gemspec
43
- - setup.rb
44
32
  - docs/bind-array-to-in_cond.md
45
33
  - docs/conflicts-local-connections-and-processes.md
46
34
  - docs/hanging-after-inactivity.md
@@ -50,7 +38,6 @@ files:
50
38
  - docs/install-on-osx.md
51
39
  - docs/ldap-auth-and-function-interposition.md
52
40
  - docs/number-type-mapping.md
53
- - docs/osx-install-dev-tools.png
54
41
  - docs/platform-specific-issues.md
55
42
  - docs/report-installation-issue.md
56
43
  - docs/timeout-parameters.md
@@ -92,8 +79,8 @@ files:
92
79
  - ext/oci8/util.c
93
80
  - ext/oci8/win32.c
94
81
  - lib/.document
95
- - lib/oci8.rb
96
82
  - lib/dbd/OCI8.rb
83
+ - lib/oci8.rb
97
84
  - lib/oci8/.document
98
85
  - lib/oci8/bindtype.rb
99
86
  - lib/oci8/check_load_error.rb
@@ -111,6 +98,10 @@ files:
111
98
  - lib/oci8/properties.rb
112
99
  - lib/oci8/version.rb
113
100
  - lib/ruby-oci8.rb
101
+ - metaconfig
102
+ - pre-distclean.rb
103
+ - ruby-oci8.gemspec
104
+ - setup.rb
114
105
  - test/README.md
115
106
  - test/config.rb
116
107
  - test/setup_test_object.sql
@@ -120,18 +111,18 @@ files:
120
111
  - test/test_array_dml.rb
121
112
  - test/test_bind_array.rb
122
113
  - test/test_bind_boolean.rb
114
+ - test/test_bind_integer.rb
123
115
  - test/test_bind_raw.rb
124
116
  - test/test_bind_string.rb
125
117
  - test/test_bind_time.rb
126
- - test/test_bind_integer.rb
127
118
  - test/test_break.rb
128
119
  - test/test_clob.rb
129
120
  - test/test_connection_pool.rb
130
121
  - test/test_connstr.rb
131
- - test/test_encoding.rb
132
122
  - test/test_datetime.rb
133
123
  - test/test_dbi.rb
134
124
  - test/test_dbi_clob.rb
125
+ - test/test_encoding.rb
135
126
  - test/test_error.rb
136
127
  - test/test_metadata.rb
137
128
  - test/test_object.rb
@@ -142,39 +133,28 @@ files:
142
133
  - test/test_package_type.rb
143
134
  - test/test_properties.rb
144
135
  - test/test_rowid.rb
145
- has_rdoc: true
146
136
  homepage: http://www.rubydoc.info/github/kubo/ruby-oci8
147
- licenses:
137
+ licenses:
148
138
  - BSD-2-Clause
139
+ metadata: {}
149
140
  post_install_message:
150
141
  rdoc_options: []
151
-
152
- require_paths:
142
+ require_paths:
153
143
  - lib
154
- required_ruby_version: !ruby/object:Gem::Requirement
155
- none: false
156
- requirements:
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
157
146
  - - ">="
158
- - !ruby/object:Gem::Version
159
- segments:
160
- - 1
161
- - 9
162
- - 1
147
+ - !ruby/object:Gem::Version
163
148
  version: 1.9.1
164
- required_rubygems_version: !ruby/object:Gem::Requirement
165
- none: false
166
- requirements:
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
167
151
  - - ">="
168
- - !ruby/object:Gem::Version
169
- segments:
170
- - 0
171
- version: "0"
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
172
154
  requirements: []
173
-
174
- rubyforge_project:
175
- rubygems_version: 1.3.7
155
+ rubygems_version: 3.1.2
176
156
  signing_key:
177
- specification_version: 3
157
+ specification_version: 4
178
158
  summary: Ruby interface for Oracle using OCI8 API
179
- test_files:
159
+ test_files:
180
160
  - test/test_all.rb
Binary file