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,255 @@
1
+ # Low-level API
2
+ require 'oci8'
3
+ require File.dirname(__FILE__) + '/config'
4
+
5
+ class TestOraDate < Minitest::Test
6
+
7
+ YEAR_CHECK_TARGET = [-4712, -1, 1, 1192, 1868, 2002, 9999]
8
+ MONTH_CHECK_TARGET = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
9
+ DAY_CHECK_TARGET = [1, 10, 20, 31] # days of January.
10
+ HOUR_CHECK_TARGET = [0, 6, 12, 18, 23]
11
+ MINUTE_CHECK_TARGET = [0, 15, 30, 45, 59]
12
+ SECOND_CHECK_TARGET = [0, 15, 30, 45, 59]
13
+
14
+ def setup
15
+ @conn = get_oci8_connection
16
+ end
17
+
18
+ def check_oradate(target, year, month, day, hour, minute, second)
19
+ assert_equal(year, target.year)
20
+ assert_equal(month, target.month)
21
+ assert_equal(day, target.day)
22
+ assert_equal(hour, target.hour)
23
+ assert_equal(minute, target.minute)
24
+ assert_equal(second, target.second)
25
+ end
26
+
27
+ def test_new()
28
+ check_oradate(OraDate.new(), 1, 1, 1, 0, 0, 0)
29
+ end
30
+
31
+ def test_set_year
32
+ cursor = @conn.parse("BEGIN :year := TO_NUMBER(TO_CHAR(:date, 'SYYYY'), '9999'); END;")
33
+ cursor.bind_param(:date, OraDate)
34
+ cursor.bind_param(:year, Fixnum)
35
+ date = OraDate.new()
36
+ YEAR_CHECK_TARGET.each do |i|
37
+ # set year
38
+ date.year = i
39
+ # check result via oracle.
40
+ cursor[:date] = date
41
+ cursor.exec
42
+ assert_equal(i, cursor[:year])
43
+ end
44
+ end
45
+
46
+ def test_get_year
47
+ cursor = @conn.parse("BEGIN :date := TO_DATE(TO_CHAR(:year, '0999'), 'SYYYY'); END;")
48
+ cursor.bind_param(:year, Fixnum)
49
+ cursor.bind_param(:date, OraDate)
50
+ YEAR_CHECK_TARGET.each do |i|
51
+ # set date via oracle.
52
+ cursor[:year] = i
53
+ cursor.exec
54
+ # check OraDate#year
55
+ assert_equal(i, cursor[:date].year)
56
+ end
57
+ end
58
+
59
+ def test_set_month
60
+ cursor = @conn.parse("BEGIN :month := TO_NUMBER(TO_CHAR(:date, 'MM'), '99'); END;")
61
+ cursor.bind_param(:date, OraDate)
62
+ cursor.bind_param(:month, Fixnum)
63
+ date = OraDate.new()
64
+ MONTH_CHECK_TARGET.each do |i|
65
+ # set month
66
+ date.month = i
67
+ # check result via oracle.
68
+ cursor[:date] = date
69
+ cursor.exec
70
+ assert_equal(i, cursor[:month])
71
+ end
72
+ end
73
+
74
+ def test_get_month
75
+ cursor = @conn.parse("BEGIN :date := TO_DATE(TO_CHAR(:month, '99'), 'MM'); END;")
76
+ cursor.bind_param(:month, Fixnum)
77
+ cursor.bind_param(:date, OraDate)
78
+ MONTH_CHECK_TARGET.each do |i|
79
+ # set date via oracle.
80
+ cursor[:month] = i
81
+ cursor.exec
82
+ # check OraDate#month
83
+ assert_equal(i, cursor[:date].month)
84
+ end
85
+ end
86
+
87
+ def test_set_day
88
+ cursor = @conn.parse("BEGIN :day := TO_NUMBER(TO_CHAR(:date, 'DD'), '99'); END;")
89
+ cursor.bind_param(:date, OraDate)
90
+ cursor.bind_param(:day, Fixnum)
91
+ date = OraDate.new()
92
+ DAY_CHECK_TARGET.each do |i|
93
+ # set day
94
+ date.day = i
95
+ # check result via oracle.
96
+ cursor[:date] = date
97
+ cursor.exec
98
+ assert_equal(i, cursor[:day])
99
+ end
100
+ end
101
+
102
+ def test_get_day
103
+ cursor = @conn.parse("BEGIN :date := TO_DATE('200101' || TO_CHAR(:day, 'FM00'), 'YYYYMMDD'); END;")
104
+ cursor.bind_param(:day, Fixnum)
105
+ cursor.bind_param(:date, OraDate)
106
+ DAY_CHECK_TARGET.each do |i|
107
+ # set date via oracle.
108
+ cursor[:day] = i
109
+ cursor.exec
110
+ # check OraDate#day
111
+ assert_equal(i, cursor[:date].day)
112
+ end
113
+ end
114
+
115
+ def test_set_hour
116
+ cursor = @conn.parse("BEGIN :hour := TO_NUMBER(TO_CHAR(:date, 'HH24'), '99'); END;")
117
+ cursor.bind_param(:date, OraDate)
118
+ cursor.bind_param(:hour, Fixnum)
119
+ date = OraDate.new()
120
+ HOUR_CHECK_TARGET.each do |i|
121
+ # set hour
122
+ date.hour = i
123
+ # check result via oracle.
124
+ cursor[:date] = date
125
+ cursor.exec
126
+ assert_equal(i, cursor[:hour])
127
+ end
128
+ end
129
+
130
+ def test_get_hour
131
+ cursor = @conn.parse("BEGIN :date := TO_DATE(TO_CHAR(:hour, '99'), 'HH24'); END;")
132
+ cursor.bind_param(:hour, Fixnum)
133
+ cursor.bind_param(:date, OraDate)
134
+ HOUR_CHECK_TARGET.each do |i|
135
+ # set date via oracle.
136
+ cursor[:hour] = i
137
+ cursor.exec
138
+ # check OraDate#hour
139
+ assert_equal(i, cursor[:date].hour)
140
+ end
141
+ end
142
+
143
+ def test_set_minute
144
+ cursor = @conn.parse("BEGIN :minute := TO_NUMBER(TO_CHAR(:date, 'MI'), '99'); END;")
145
+ cursor.bind_param(:date, OraDate)
146
+ cursor.bind_param(:minute, Fixnum)
147
+ date = OraDate.new()
148
+ MINUTE_CHECK_TARGET.each do |i|
149
+ # set minute
150
+ date.minute = i
151
+ # check result via oracle.
152
+ cursor[:date] = date
153
+ cursor.exec
154
+ assert_equal(i, cursor[:minute])
155
+ end
156
+ end
157
+
158
+ def test_get_minute
159
+ cursor = @conn.parse("BEGIN :date := TO_DATE(TO_CHAR(:minute, '99'), 'MI'); END;")
160
+ cursor.bind_param(:minute, Fixnum)
161
+ cursor.bind_param(:date, OraDate)
162
+ MINUTE_CHECK_TARGET.each do |i|
163
+ # set date via oracle.
164
+ cursor[:minute] = i
165
+ cursor.exec
166
+ # check OraDate#minute
167
+ assert_equal(i, cursor[:date].minute)
168
+ end
169
+ end
170
+
171
+ def test_set_second
172
+ cursor = @conn.parse("BEGIN :second := TO_NUMBER(TO_CHAR(:date, 'SS'), '99'); END;")
173
+ cursor.bind_param(:date, OraDate)
174
+ cursor.bind_param(:second, Fixnum)
175
+ date = OraDate.new()
176
+ SECOND_CHECK_TARGET.each do |i|
177
+ # set second
178
+ date.second = i
179
+ # check result via oracle.
180
+ cursor[:date] = date
181
+ cursor.exec
182
+ assert_equal(i, cursor[:second])
183
+ end
184
+ end
185
+
186
+ def test_get_second
187
+ cursor = @conn.parse("BEGIN :date := TO_DATE(TO_CHAR(:second, '99'), 'SS'); END;")
188
+ cursor.bind_param(:second, Fixnum)
189
+ cursor.bind_param(:date, OraDate)
190
+ SECOND_CHECK_TARGET.each do |i|
191
+ # set date via oracle.
192
+ cursor[:second] = i
193
+ cursor.exec
194
+ # check OraDate#second
195
+ assert_equal(i, cursor[:date].second)
196
+ end
197
+ end
198
+
199
+ def test_compare
200
+ d1 = OraDate.new(2003,03,15,18,55,35)
201
+ d2 = OraDate.new(2003,03,15,18,55,35)
202
+ assert_equal(d1, d2)
203
+ assert_operator(d1, :<, OraDate.new(2004,03,15,18,55,35))
204
+ assert_operator(d1, :<, OraDate.new(2003,04,15,18,55,35))
205
+ assert_operator(d1, :<, OraDate.new(2003,03,16,18,55,35))
206
+ assert_operator(d1, :<, OraDate.new(2003,03,15,19,55,35))
207
+ assert_operator(d1, :<, OraDate.new(2003,03,15,18,56,35))
208
+ assert_operator(d1, :<, OraDate.new(2003,03,15,18,55,36))
209
+
210
+ assert_operator(OraDate.new(2002,03,15,18,55,35), :<, d1)
211
+ assert_operator(OraDate.new(2003,02,15,18,55,35), :<, d1)
212
+ assert_operator(OraDate.new(2003,03,14,18,55,35), :<, d1)
213
+ assert_operator(OraDate.new(2003,03,15,17,55,35), :<, d1)
214
+ assert_operator(OraDate.new(2003,03,15,18,54,35), :<, d1)
215
+ assert_operator(OraDate.new(2003,03,15,18,55,34), :<, d1)
216
+ end
217
+
218
+ def test_to_time
219
+ year, month, day, hour, minute, second = [2003,03,15,18,55,35]
220
+ dt = OraDate.new(year, month, day, hour, minute, second)
221
+ tm = Time.local(year, month, day, hour, minute, second)
222
+ assert_equal(tm, dt.to_time)
223
+
224
+ # year, month, day, hour, minute, second = [1900,1,1,0,0,0]
225
+ # dt = OraDate.new(year, month, day, hour, minute, second)
226
+ # assert_exception(RangeError) { dt.to_time }
227
+ end
228
+
229
+ def test_to_date
230
+ [[2003,03,15], [1900,1,1], [-4712, 1, 1]].each do |year, month, day|
231
+ odt = OraDate.new(year, month, day)
232
+ rdt = Date.new(year, month, day)
233
+ assert_equal(rdt, odt.to_date)
234
+ end
235
+ end
236
+
237
+ def test_dup
238
+ [[2003,03,15], [1900,1,1], [-4712, 1, 1]].each do |year, month, day|
239
+ dt = OraDate.new(year, month, day)
240
+ assert_equal(dt, dt.dup)
241
+ assert_equal(dt, dt.clone)
242
+ end
243
+ end
244
+
245
+ def test_marshal
246
+ [[2003,03,15], [1900,1,1], [-4712, 1, 1]].each do |year, month, day|
247
+ dt = OraDate.new(year, month, day)
248
+ assert_equal(dt, Marshal.load(Marshal.dump(dt)))
249
+ end
250
+ end
251
+
252
+ def teardown
253
+ @conn.logoff
254
+ end
255
+ end