ruby-oci8 2.2.3-x86-mingw32 → 2.2.4-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -117,8 +117,9 @@ class OCI8
117
117
  else
118
118
  tcp_connect_timeout = OCI8::properties[:tcp_connect_timeout]
119
119
  connect_timeout = OCI8::properties[:connect_timeout]
120
- if tcp_connect_timeout || connect_timeout
121
- dbname = to_connect_descriptor(dbname, tcp_connect_timeout, connect_timeout)
120
+ tcp_keepalive = OCI8::properties[:tcp_keepalive]
121
+ if tcp_connect_timeout || connect_timeout || tcp_keepalive
122
+ dbname = to_connect_descriptor(dbname, tcp_connect_timeout, connect_timeout, tcp_keepalive)
122
123
  end
123
124
  end
124
125
  if stmt_cache_size
@@ -558,7 +559,7 @@ class OCI8
558
559
  # and add TRANSPORT_CONNECT_TIMEOUT or CONNECT_TIMEOUT.
559
560
  #
560
561
  # @private
561
- def to_connect_descriptor(database, tcp_connect_timeout, connect_timeout)
562
+ def to_connect_descriptor(database, tcp_connect_timeout, connect_timeout, tcp_keepalive)
562
563
  if @@easy_connect_naming_regex =~ database && ($1 || $2 || $4 || $5 || $6 || $7)
563
564
  connect_data = []
564
565
  connect_data << "(SERVICE_NAME=#$5)"
@@ -573,6 +574,9 @@ class OCI8
573
574
  if connect_timeout
574
575
  desc << "(CONNECT_TIMEOUT=#{connect_timeout})"
575
576
  end
577
+ if tcp_keepalive
578
+ desc << "(ENABLE=BROKEN)"
579
+ end
576
580
  "(DESCRIPTION=#{desc.join})"
577
581
  else
578
582
  database
@@ -17,6 +17,8 @@ class OCI8
17
17
  :connect_timeout => nil,
18
18
  :send_timeout => nil,
19
19
  :recv_timeout => nil,
20
+ :tcp_keepalive => false,
21
+ :tcp_keepalive_time => nil,
20
22
  }
21
23
 
22
24
  # @private
@@ -62,6 +64,14 @@ class OCI8
62
64
  val = val.to_i
63
65
  raise ArgumentError, "The property value for :#{name} must be nil or a positive integer." if val <= 0
64
66
  end
67
+ when :tcp_keepalive
68
+ val = val ? true : false
69
+ when :tcp_keepalive_time
70
+ if !val.nil?
71
+ val = val.to_i
72
+ raise ArgumentError, "The property value for :#{name} must be nil or a positive integer." if val <= 0
73
+ end
74
+ OCI8.__set_prop(4, val)
65
75
  end
66
76
  super(name, val)
67
77
  end
@@ -165,6 +175,18 @@ class OCI8
165
175
  #
166
176
  # *Since:* 2.2.2
167
177
  #
178
+ # [:tcp_keepalive]
179
+ #
180
+ # See {file:docs/hanging-after-inactivity.md.md}
181
+ #
182
+ # *Since:* 2.2.4
183
+ #
184
+ # [:tcp_keepalive_time]
185
+ #
186
+ # See {file:docs/hanging-after-inactivity.md.md}
187
+ #
188
+ # *Since:* 2.2.4
189
+ #
168
190
  # @return [a customized Hash]
169
191
  # @since 2.0.5
170
192
  #
@@ -1,3 +1,3 @@
1
1
  class OCI8
2
- VERSION = "2.2.3"
2
+ VERSION = "2.2.4"
3
3
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -64,11 +64,7 @@ EOS
64
64
  raise "No compiled binary are found. Run make in advance."
65
65
  when 1
66
66
  puts "Binary gem for ruby #{so_vers.first}"
67
- if so_vers[0] < '2.0.0'
68
- s.required_ruby_version = "~> #{so_vermin}"
69
- else
70
- s.required_ruby_version = "~> #{so_vermin}.0"
71
- end
67
+ s.required_ruby_version = "~> #{so_vermin}"
72
68
  else
73
69
  puts "Binary gem for ruby #{so_vers.join(', ')}"
74
70
  s.required_ruby_version = ">= #{so_vermin}"
@@ -9,6 +9,7 @@ require "#{srcdir}/test_bind_array.rb"
9
9
  require "#{srcdir}/test_bind_string"
10
10
  require "#{srcdir}/test_bind_time"
11
11
  require "#{srcdir}/test_bind_raw"
12
+ require "#{srcdir}/test_bind_integer"
12
13
  if $test_clob
13
14
  require "#{srcdir}/test_clob"
14
15
  end
@@ -0,0 +1,47 @@
1
+ require 'oci8'
2
+ require File.dirname(__FILE__) + '/config'
3
+
4
+ class TestBindInteger < Minitest::Test
5
+
6
+ def setup
7
+ @conn = get_oci8_connection
8
+ end
9
+
10
+ POSITIVE_INTS = [
11
+ 100,
12
+ 2**30,
13
+ 2**31,
14
+ 2**32,
15
+ 2**33,
16
+ 2**62,
17
+ 2**63,
18
+ 2**64,
19
+ ('9' * 38).to_i
20
+ ]
21
+
22
+ def bind_and_get(input_value, output_type)
23
+ cursor = @conn.parse("BEGIN :out := :in; END;")
24
+ cursor.bind_param(:out, output_type)
25
+ cursor.bind_param(:in, input_value)
26
+ cursor.exec
27
+ result = cursor[:out]
28
+ cursor.close
29
+ result
30
+ end
31
+
32
+ (POSITIVE_INTS + [0] + POSITIVE_INTS.map(&:-@)).each do |num|
33
+ define_method("test_bind_param_with_input_of '#{num}'") do
34
+ assert_equal(OraNumber.new(num.to_s), bind_and_get(num, OraNumber))
35
+ end
36
+
37
+ define_method("test_bind_param_with_output_of '#{num}'") do
38
+ result = bind_and_get(OraNumber.new(num.to_s), Integer)
39
+ assert_equal(num, result)
40
+ assert_kind_of(Integer, result)
41
+ end
42
+ end
43
+
44
+ def teardown
45
+ @conn.logoff
46
+ end
47
+ end
@@ -80,9 +80,9 @@ class TestConnStr < Minitest::Test
80
80
  DESC_TEST_CASE =
81
81
  [
82
82
  # Cannot distinguish net service names from easy connect strings in this case.
83
- ["sales-server", nil, nil, "sales-server"],
83
+ ["sales-server", nil, nil, false, "sales-server"],
84
84
  # Easy Connect string with host.
85
- ["//sales-server", nil, nil, <<EOS],
85
+ ["//sales-server", nil, nil, false, <<EOS],
86
86
  (DESCRIPTION=
87
87
  (CONNECT_DATA=
88
88
  (SERVICE_NAME=))
@@ -92,7 +92,7 @@ class TestConnStr < Minitest::Test
92
92
  (PORT=1521)))
93
93
  EOS
94
94
  # Easy Connect string with host and port.
95
- ["sales-server:3456", nil, nil, <<EOS],
95
+ ["sales-server:3456", nil, nil, false, <<EOS],
96
96
  (DESCRIPTION=
97
97
  (CONNECT_DATA=
98
98
  (SERVICE_NAME=))
@@ -102,7 +102,7 @@ EOS
102
102
  (PORT=3456)))
103
103
  EOS
104
104
  # The host name is sales-server and the service name is sales.
105
- ["sales-server/sales", nil, nil, <<EOS],
105
+ ["sales-server/sales", nil, nil, false, <<EOS],
106
106
  (DESCRIPTION=
107
107
  (CONNECT_DATA=
108
108
  (SERVICE_NAME=sales))
@@ -112,7 +112,7 @@ EOS
112
112
  (PORT=1521)))
113
113
  EOS
114
114
  # Easy Connect string with IPv6 address.
115
- ["[2001:0db8:0:0::200C:417A]:80/sales", nil, nil, <<EOS],
115
+ ["[2001:0db8:0:0::200C:417A]:80/sales", nil, nil, false, <<EOS],
116
116
  (DESCRIPTION=
117
117
  (CONNECT_DATA=
118
118
  (SERVICE_NAME=sales))
@@ -122,7 +122,7 @@ EOS
122
122
  (PORT=80)))
123
123
  EOS
124
124
  # Easy Connect string with IPv6 host address.
125
- ["sales-server:80/sales", nil, nil, <<EOS],
125
+ ["sales-server:80/sales", nil, nil, false, <<EOS],
126
126
  (DESCRIPTION=
127
127
  (CONNECT_DATA=
128
128
  (SERVICE_NAME=sales))
@@ -132,7 +132,7 @@ EOS
132
132
  (PORT=80)))
133
133
  EOS
134
134
  # Easy Connect string with host, service name, and server.
135
- ["sales-server/sales:dedicated/inst1", nil, nil, <<EOS],
135
+ ["sales-server/sales:dedicated/inst1", nil, nil, false, <<EOS],
136
136
  (DESCRIPTION=
137
137
  (CONNECT_DATA=
138
138
  (SERVICE_NAME=sales)
@@ -143,7 +143,7 @@ EOS
143
143
  (HOST=sales-server)
144
144
  (PORT=1521)))
145
145
  EOS
146
- ["sales-server//inst1", nil, nil, <<EOS],
146
+ ["sales-server//inst1", nil, nil, false, <<EOS],
147
147
  (DESCRIPTION=
148
148
  (CONNECT_DATA=
149
149
  (SERVICE_NAME=)
@@ -154,7 +154,7 @@ EOS
154
154
  (PORT=1521)))
155
155
  EOS
156
156
  #
157
- ["sales-server/sales", 20, nil, <<EOS],
157
+ ["sales-server/sales", 20, nil, false, <<EOS],
158
158
  (DESCRIPTION=
159
159
  (CONNECT_DATA=
160
160
  (SERVICE_NAME=sales))
@@ -165,7 +165,7 @@ EOS
165
165
  (TRANSPORT_CONNECT_TIMEOUT=20))
166
166
  EOS
167
167
  #
168
- ["sales-server/sales", nil, 30, <<EOS],
168
+ ["sales-server/sales", nil, 30, false, <<EOS],
169
169
  (DESCRIPTION=
170
170
  (CONNECT_DATA=
171
171
  (SERVICE_NAME=sales))
@@ -176,7 +176,7 @@ EOS
176
176
  (CONNECT_TIMEOUT=30))
177
177
  EOS
178
178
  #
179
- ["sales-server/sales", 20, 30, <<EOS],
179
+ ["sales-server/sales", 20, 30, false, <<EOS],
180
180
  (DESCRIPTION=
181
181
  (CONNECT_DATA=
182
182
  (SERVICE_NAME=sales))
@@ -186,6 +186,21 @@ EOS
186
186
  (PORT=1521))
187
187
  (TRANSPORT_CONNECT_TIMEOUT=20)
188
188
  (CONNECT_TIMEOUT=30))
189
+ EOS
190
+ ["sales-server/sales", 20, 30, true, <<EOS],
191
+ (DESCRIPTION=
192
+ (CONNECT_DATA=
193
+ (SERVICE_NAME=sales)
194
+ )
195
+ (ADDRESS=
196
+ (PROTOCOL=TCP)
197
+ (HOST=sales-server)
198
+ (PORT=1521)
199
+ )
200
+ (TRANSPORT_CONNECT_TIMEOUT=20)
201
+ (CONNECT_TIMEOUT=30)
202
+ (ENABLE=BROKEN)
203
+ )
189
204
  EOS
190
205
  ]
191
206
 
@@ -195,9 +210,10 @@ EOS
195
210
  easy_connect_string = test_case[0]
196
211
  tcp_connnect_timeout= test_case[1]
197
212
  outbound_connnect_timeout = test_case[2]
198
- expected_result = test_case[3].gsub(/\s/, '')
213
+ tcp_keepalive = test_case[3]
214
+ expected_result = test_case[4].gsub(/\s/, '')
199
215
  # use instance_eval to call a private method to_connect_descriptor
200
- result = obj.instance_eval { to_connect_descriptor(easy_connect_string, tcp_connnect_timeout, outbound_connnect_timeout) }
216
+ result = obj.instance_eval { to_connect_descriptor(easy_connect_string, tcp_connnect_timeout, outbound_connnect_timeout, tcp_keepalive) }
201
217
  assert_equal(expected_result, result, easy_connect_string)
202
218
  end
203
219
  end
@@ -216,8 +216,8 @@ EOS
216
216
  assert_nil(rv[4])
217
217
  assert_nil(rv[5])
218
218
  else
219
- dttm = DateTime.civil(2000 + i, 8, 3, 23, 59, 59, Time.now.utc_offset.to_r/86400)
220
219
  tm = Time.local(2000 + i, 8, 3, 23, 59, 59)
220
+ dttm = DateTime.civil(2000 + i, 8, 3, 23, 59, 59, tm.utc_offset.to_r/86400)
221
221
  dt = Date.civil(2000 + i, 8, 3)
222
222
  assert_equal(tm, rv[3])
223
223
  assert_equal(dttm, rv[4])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-oci8
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 3
10
- version: 2.2.3
9
+ - 4
10
+ version: 2.2.4
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Kubo Takehiro
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2016-12-27 00:00:00 +09:00
18
+ date: 2017-06-11 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -48,6 +48,7 @@ files:
48
48
  - docs/install-instant-client.md
49
49
  - docs/install-on-osx.md
50
50
  - docs/conflicts-local-connections-and-processes.md
51
+ - docs/hanging-after-inactivity.md
51
52
  - docs/osx-install-dev-tools.png
52
53
  - docs/platform-specific-issues.md
53
54
  - docs/report-installation-issue.md
@@ -82,6 +83,7 @@ files:
82
83
  - test/test_bind_raw.rb
83
84
  - test/test_bind_string.rb
84
85
  - test/test_bind_time.rb
86
+ - test/test_bind_integer.rb
85
87
  - test/test_break.rb
86
88
  - test/test_clob.rb
87
89
  - test/test_connection_pool.rb
@@ -100,11 +102,11 @@ files:
100
102
  - test/test_package_type.rb
101
103
  - test/test_rowid.rb
102
104
  - lib/oci8lib_191.so
103
- - lib/oci8lib_200.so
104
105
  - lib/oci8lib_210.so
105
- - lib/oci8lib_220.so
106
- - lib/oci8lib_230.so
106
+ - lib/oci8lib_200.so
107
107
  - lib/oci8lib_240.so
108
+ - lib/oci8lib_230.so
109
+ - lib/oci8lib_220.so
108
110
  has_rdoc: true
109
111
  homepage: http://www.rubydoc.info/github/kubo/ruby-oci8
110
112
  licenses: