ruby-oci8 2.2.10-x64-mingw-ucrt
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 +14 -0
- data/COPYING +30 -0
- data/COPYING_old +64 -0
- data/ChangeLog +3826 -0
- data/Makefile +92 -0
- data/NEWS +1209 -0
- data/README.md +66 -0
- data/dist-files +112 -0
- 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 +44 -0
- data/docs/install-full-client.md +111 -0
- data/docs/install-instant-client.md +194 -0
- data/docs/install-on-osx.md +46 -0
- data/docs/ldap-auth-and-function-interposition.md +123 -0
- data/docs/number-type-mapping.md +79 -0
- data/docs/platform-specific-issues.md +164 -0
- data/docs/report-installation-issue.md +50 -0
- data/docs/timeout-parameters.md +94 -0
- data/lib/.document +1 -0
- data/lib/dbd/OCI8.rb +591 -0
- data/lib/oci8/.document +8 -0
- data/lib/oci8/bindtype.rb +333 -0
- data/lib/oci8/check_load_error.rb +146 -0
- data/lib/oci8/compat.rb +117 -0
- data/lib/oci8/connection_pool.rb +179 -0
- data/lib/oci8/cursor.rb +605 -0
- data/lib/oci8/datetime.rb +605 -0
- data/lib/oci8/encoding-init.rb +45 -0
- data/lib/oci8/encoding.yml +537 -0
- data/lib/oci8/metadata.rb +2148 -0
- data/lib/oci8/object.rb +641 -0
- data/lib/oci8/oci8.rb +756 -0
- data/lib/oci8/ocihandle.rb +591 -0
- data/lib/oci8/oracle_version.rb +153 -0
- data/lib/oci8/properties.rb +196 -0
- data/lib/oci8/version.rb +3 -0
- data/lib/oci8.rb +190 -0
- data/lib/oci8lib_310.so +0 -0
- data/lib/ruby-oci8.rb +1 -0
- data/metaconfig +142 -0
- data/pre-distclean.rb +7 -0
- data/ruby-oci8.gemspec +85 -0
- data/setup.rb +1342 -0
- data/test/README.md +37 -0
- data/test/config.rb +201 -0
- data/test/setup_test_object.sql +199 -0
- data/test/setup_test_package.sql +59 -0
- data/test/test_all.rb +56 -0
- data/test/test_appinfo.rb +62 -0
- data/test/test_array_dml.rb +332 -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_bind_raw.rb +45 -0
- data/test/test_bind_string.rb +105 -0
- data/test/test_bind_time.rb +177 -0
- data/test/test_break.rb +125 -0
- data/test/test_clob.rb +85 -0
- data/test/test_connection_pool.rb +124 -0
- data/test/test_connstr.rb +220 -0
- data/test/test_datetime.rb +585 -0
- data/test/test_dbi.rb +365 -0
- data/test/test_dbi_clob.rb +53 -0
- data/test/test_encoding.rb +103 -0
- data/test/test_error.rb +87 -0
- data/test/test_metadata.rb +2674 -0
- data/test/test_object.rb +546 -0
- data/test/test_oci8.rb +624 -0
- data/test/test_oracle_version.rb +68 -0
- data/test/test_oradate.rb +255 -0
- data/test/test_oranumber.rb +792 -0
- data/test/test_package_type.rb +981 -0
- data/test/test_properties.rb +17 -0
- data/test/test_rowid.rb +32 -0
- metadata +123 -0
@@ -0,0 +1,220 @@
|
|
1
|
+
require 'oci8'
|
2
|
+
require File.dirname(__FILE__) + '/config'
|
3
|
+
|
4
|
+
class TestConnStr < Minitest::Test
|
5
|
+
TEST_CASES =
|
6
|
+
[
|
7
|
+
# success cases:
|
8
|
+
# [ 'connect_string', expected result as an array]
|
9
|
+
# error cases:
|
10
|
+
# [ 'connect_string', ExceptionClass]
|
11
|
+
["hr/hr@host/service_name", ["hr", "hr", "host/service_name", nil]],
|
12
|
+
["sys/syspw@host/service_name AS SYSdba ", ["sys", "syspw", "host/service_name", :SYSDBA]],
|
13
|
+
["sys/syspw@host:1521/service_name as sysdba", ["sys", "syspw", "host:1521/service_name", :SYSDBA]],
|
14
|
+
# error cases
|
15
|
+
["service_name", ArgumentError],
|
16
|
+
["", ArgumentError],
|
17
|
+
["foo bar/baz", ArgumentError],
|
18
|
+
["foo@bar/baz", ArgumentError],
|
19
|
+
# parse_connect_string doesn't check validity of privilege.
|
20
|
+
["foo/bar as foo_bar", ["foo", "bar", nil, :FOO_BAR]],
|
21
|
+
|
22
|
+
##
|
23
|
+
## following test cases are contributed by Shiwei Zhang.
|
24
|
+
##
|
25
|
+
#"username/password"
|
26
|
+
["username/password", ["username", "password", nil, nil]],
|
27
|
+
#"username/password@[//]host[:port][/service_name]"
|
28
|
+
["username/password@host", ["username", "password", "host", nil]],
|
29
|
+
["username/password@host/service_name", ["username", "password", "host/service_name", nil]],
|
30
|
+
["username/password@host:1521", ["username", "password", "host:1521", nil]],
|
31
|
+
["username/password@host:1521/service_name", ["username", "password", "host:1521/service_name", nil]],
|
32
|
+
["username/password@//host", ["username", "password", "//host", nil]],
|
33
|
+
["username/password@//host/service_name", ["username", "password", "//host/service_name", nil]],
|
34
|
+
["username/password@//host:1521", ["username", "password", "//host:1521", nil]],
|
35
|
+
["username/password@//host:1521/service_name", ["username", "password", "//host:1521/service_name", nil]],
|
36
|
+
#"username/password as{sysoper|sysdba}"
|
37
|
+
["username/password as sysoper", ["username", "password", nil, :SYSOPER]],
|
38
|
+
["username/password as sysdba", ["username", "password", nil, :SYSDBA]],
|
39
|
+
#"username/password@[//]host[:port][/service_name] as {sysoper|sysdba}"
|
40
|
+
["username/password@host as sysoper", ["username", "password", "host", :SYSOPER]],
|
41
|
+
["username/password@host as sysdba", ["username", "password", "host", :SYSDBA]],
|
42
|
+
["username/password@host/service_name as sysoper", ["username", "password", "host/service_name", :SYSOPER]],
|
43
|
+
["username/password@host/service_name as sysdba", ["username", "password", "host/service_name", :SYSDBA]],
|
44
|
+
["username/password@host:1521 as sysoper", ["username", "password", "host:1521", :SYSOPER]],
|
45
|
+
["username/password@host:1521 as sysdba", ["username", "password", "host:1521", :SYSDBA]],
|
46
|
+
["username/password@host:1521/service_name as sysoper", ["username", "password", "host:1521/service_name", :SYSOPER]],
|
47
|
+
["username/password@host:1521/service_name as sysdba", ["username", "password", "host:1521/service_name", :SYSDBA]],
|
48
|
+
["username/password@//host as sysoper", ["username", "password", "//host", :SYSOPER]],
|
49
|
+
["username/password@//host as sysdba", ["username", "password", "//host", :SYSDBA]],
|
50
|
+
["username/password@//host/service_name as sysoper", ["username", "password", "//host/service_name", :SYSOPER]],
|
51
|
+
["username/password@//host/service_name as sysdba", ["username", "password", "//host/service_name", :SYSDBA]],
|
52
|
+
["username/password@//host:1521 as sysoper", ["username", "password", "//host:1521", :SYSOPER]],
|
53
|
+
["username/password@//host:1521 as sysdba", ["username", "password", "//host:1521", :SYSDBA]],
|
54
|
+
["username/password@//host:1521/service_name as sysoper", ["username", "password", "//host:1521/service_name", :SYSOPER]],
|
55
|
+
["username/password@//host:1521/service_name as sysdba", ["username", "password", "//host:1521/service_name", :SYSDBA]],
|
56
|
+
["/passwd@192.168.19.19:1521/orcl as sysdba", ["", "passwd", "192.168.19.19:1521/orcl", :SYSDBA]],
|
57
|
+
["/", [nil, nil, nil, nil]],
|
58
|
+
["/ as sysdba", [nil, nil, nil, :SYSDBA]],
|
59
|
+
]
|
60
|
+
|
61
|
+
def test_connstr
|
62
|
+
obj = OCI8.allocate # create an uninitialized object.
|
63
|
+
TEST_CASES.each do |test_case|
|
64
|
+
case test_case[1]
|
65
|
+
when Array
|
66
|
+
# use instance_eval to call a private method parse_connect_string.
|
67
|
+
result = obj.instance_eval { parse_connect_string(test_case[0]) }
|
68
|
+
assert_equal(test_case[1], result, test_case[0])
|
69
|
+
when Class
|
70
|
+
assert_raises(test_case[1]) do
|
71
|
+
result = obj.instance_eval { parse_connect_string(test_case[0]) }
|
72
|
+
end
|
73
|
+
else
|
74
|
+
raise "unsupported testcase"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# https://docs.oracle.com/database/121/NETAG/naming.htm#BABJBFHJ
|
80
|
+
DESC_TEST_CASE =
|
81
|
+
[
|
82
|
+
# Cannot distinguish net service names from easy connect strings in this case.
|
83
|
+
["sales-server", nil, nil, false, "sales-server"],
|
84
|
+
# Easy Connect string with host.
|
85
|
+
["//sales-server", nil, nil, false, <<EOS],
|
86
|
+
(DESCRIPTION=
|
87
|
+
(CONNECT_DATA=
|
88
|
+
(SERVICE_NAME=))
|
89
|
+
(ADDRESS=
|
90
|
+
(PROTOCOL=TCP)
|
91
|
+
(HOST=sales-server)
|
92
|
+
(PORT=1521)))
|
93
|
+
EOS
|
94
|
+
# Easy Connect string with host and port.
|
95
|
+
["sales-server:3456", nil, nil, false, <<EOS],
|
96
|
+
(DESCRIPTION=
|
97
|
+
(CONNECT_DATA=
|
98
|
+
(SERVICE_NAME=))
|
99
|
+
(ADDRESS=
|
100
|
+
(PROTOCOL=TCP)
|
101
|
+
(HOST=sales-server)
|
102
|
+
(PORT=3456)))
|
103
|
+
EOS
|
104
|
+
# The host name is sales-server and the service name is sales.
|
105
|
+
["sales-server/sales", nil, nil, false, <<EOS],
|
106
|
+
(DESCRIPTION=
|
107
|
+
(CONNECT_DATA=
|
108
|
+
(SERVICE_NAME=sales))
|
109
|
+
(ADDRESS=
|
110
|
+
(PROTOCOL=TCP)
|
111
|
+
(HOST=sales-server)
|
112
|
+
(PORT=1521)))
|
113
|
+
EOS
|
114
|
+
# Easy Connect string with IPv6 address.
|
115
|
+
["[2001:0db8:0:0::200C:417A]:80/sales", nil, nil, false, <<EOS],
|
116
|
+
(DESCRIPTION=
|
117
|
+
(CONNECT_DATA=
|
118
|
+
(SERVICE_NAME=sales))
|
119
|
+
(ADDRESS=
|
120
|
+
(PROTOCOL=TCP)
|
121
|
+
(HOST=2001:0db8:0:0::200C:417A)
|
122
|
+
(PORT=80)))
|
123
|
+
EOS
|
124
|
+
# Easy Connect string with IPv6 host address.
|
125
|
+
["sales-server:80/sales", nil, nil, false, <<EOS],
|
126
|
+
(DESCRIPTION=
|
127
|
+
(CONNECT_DATA=
|
128
|
+
(SERVICE_NAME=sales))
|
129
|
+
(ADDRESS=
|
130
|
+
(PROTOCOL=TCP)
|
131
|
+
(HOST=sales-server)
|
132
|
+
(PORT=80)))
|
133
|
+
EOS
|
134
|
+
# Easy Connect string with host, service name, and server.
|
135
|
+
["sales-server/sales:dedicated/inst1", nil, nil, false, <<EOS],
|
136
|
+
(DESCRIPTION=
|
137
|
+
(CONNECT_DATA=
|
138
|
+
(SERVICE_NAME=sales)
|
139
|
+
(SERVER=dedicated)
|
140
|
+
(INSTANCE_NAME=inst1))
|
141
|
+
(ADDRESS=
|
142
|
+
(PROTOCOL=TCP)
|
143
|
+
(HOST=sales-server)
|
144
|
+
(PORT=1521)))
|
145
|
+
EOS
|
146
|
+
["sales-server//inst1", nil, nil, false, <<EOS],
|
147
|
+
(DESCRIPTION=
|
148
|
+
(CONNECT_DATA=
|
149
|
+
(SERVICE_NAME=)
|
150
|
+
(INSTANCE_NAME=inst1))
|
151
|
+
(ADDRESS=
|
152
|
+
(PROTOCOL=TCP)
|
153
|
+
(HOST=sales-server)
|
154
|
+
(PORT=1521)))
|
155
|
+
EOS
|
156
|
+
#
|
157
|
+
["sales-server/sales", 20, nil, false, <<EOS],
|
158
|
+
(DESCRIPTION=
|
159
|
+
(CONNECT_DATA=
|
160
|
+
(SERVICE_NAME=sales))
|
161
|
+
(ADDRESS=
|
162
|
+
(PROTOCOL=TCP)
|
163
|
+
(HOST=sales-server)
|
164
|
+
(PORT=1521))
|
165
|
+
(TRANSPORT_CONNECT_TIMEOUT=20))
|
166
|
+
EOS
|
167
|
+
#
|
168
|
+
["sales-server/sales", nil, 30, false, <<EOS],
|
169
|
+
(DESCRIPTION=
|
170
|
+
(CONNECT_DATA=
|
171
|
+
(SERVICE_NAME=sales))
|
172
|
+
(ADDRESS=
|
173
|
+
(PROTOCOL=TCP)
|
174
|
+
(HOST=sales-server)
|
175
|
+
(PORT=1521))
|
176
|
+
(CONNECT_TIMEOUT=30))
|
177
|
+
EOS
|
178
|
+
#
|
179
|
+
["sales-server/sales", 20, 30, false, <<EOS],
|
180
|
+
(DESCRIPTION=
|
181
|
+
(CONNECT_DATA=
|
182
|
+
(SERVICE_NAME=sales))
|
183
|
+
(ADDRESS=
|
184
|
+
(PROTOCOL=TCP)
|
185
|
+
(HOST=sales-server)
|
186
|
+
(PORT=1521))
|
187
|
+
(TRANSPORT_CONNECT_TIMEOUT=20)
|
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
|
+
)
|
204
|
+
EOS
|
205
|
+
]
|
206
|
+
|
207
|
+
def test_connect_descriptor
|
208
|
+
obj = OCI8.allocate # create an uninitialized object.
|
209
|
+
DESC_TEST_CASE.each do |test_case|
|
210
|
+
easy_connect_string = test_case[0]
|
211
|
+
tcp_connnect_timeout= test_case[1]
|
212
|
+
outbound_connnect_timeout = test_case[2]
|
213
|
+
tcp_keepalive = test_case[3]
|
214
|
+
expected_result = test_case[4].gsub(/\s/, '')
|
215
|
+
# use instance_eval to call a private method to_connect_descriptor
|
216
|
+
result = obj.instance_eval { to_connect_descriptor(easy_connect_string, tcp_connnect_timeout, outbound_connnect_timeout, tcp_keepalive) }
|
217
|
+
assert_equal(expected_result, result, easy_connect_string)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|