ruby-oci8 1.0.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/ChangeLog +1254 -390
  2. data/Makefile +10 -13
  3. data/README +56 -385
  4. data/VERSION +1 -1
  5. data/dist-files +26 -27
  6. data/ext/oci8/.document +1 -0
  7. data/ext/oci8/MANIFEST +0 -4
  8. data/ext/oci8/apiwrap.c.tmpl +172 -0
  9. data/ext/oci8/apiwrap.h.tmpl +61 -0
  10. data/ext/oci8/apiwrap.rb +91 -0
  11. data/ext/oci8/apiwrap.yml +1243 -0
  12. data/ext/oci8/attr.c +124 -384
  13. data/ext/oci8/bind.c +472 -164
  14. data/ext/oci8/encoding.c +196 -0
  15. data/ext/oci8/env.c +84 -253
  16. data/ext/oci8/error.c +196 -127
  17. data/ext/oci8/extconf.rb +82 -59
  18. data/ext/oci8/lob.c +710 -370
  19. data/ext/oci8/metadata.c +359 -0
  20. data/ext/oci8/object.c +622 -0
  21. data/ext/oci8/oci8.c +577 -161
  22. data/ext/oci8/oci8.h +354 -258
  23. data/ext/oci8/oci8lib.c +493 -0
  24. data/ext/oci8/ocidatetime.c +473 -0
  25. data/ext/oci8/ocinumber.c +1123 -24
  26. data/ext/oci8/oraconf.rb +72 -106
  27. data/ext/oci8/oradate.c +511 -321
  28. data/ext/oci8/stmt.c +752 -572
  29. data/ext/oci8/win32.c +131 -0
  30. data/ext/oci8/xmldb.c +383 -0
  31. data/lib/.document +2 -0
  32. data/lib/dbd/OCI8.rb +2 -17
  33. data/lib/oci8.rb.in +41 -1622
  34. data/lib/oci8/.document +5 -0
  35. data/lib/oci8/compat.rb +108 -0
  36. data/lib/oci8/datetime.rb +489 -0
  37. data/lib/oci8/encoding-init.rb +40 -0
  38. data/lib/oci8/encoding.yml +537 -0
  39. data/lib/oci8/metadata.rb +2077 -0
  40. data/lib/oci8/object.rb +548 -0
  41. data/lib/oci8/oci8.rb +773 -0
  42. data/lib/oci8/oracle_version.rb +144 -0
  43. data/metaconfig +3 -3
  44. data/ruby-oci8.gemspec +5 -5
  45. data/setup.rb +4 -4
  46. data/test/config.rb +64 -84
  47. data/test/test_all.rb +14 -21
  48. data/test/test_array_dml.rb +317 -0
  49. data/test/test_bind_raw.rb +18 -25
  50. data/test/test_bind_time.rb +78 -91
  51. data/test/test_break.rb +37 -35
  52. data/test/test_clob.rb +33 -89
  53. data/test/test_connstr.rb +5 -4
  54. data/test/test_datetime.rb +469 -0
  55. data/test/test_dbi.rb +99 -60
  56. data/test/test_dbi_clob.rb +3 -8
  57. data/test/test_metadata.rb +65 -51
  58. data/test/test_oci8.rb +151 -55
  59. data/test/test_oracle_version.rb +70 -0
  60. data/test/test_oradate.rb +76 -83
  61. data/test/test_oranumber.rb +405 -71
  62. data/test/test_rowid.rb +6 -11
  63. metadata +31 -32
  64. data/NEWS +0 -420
  65. data/ext/oci8/const.c +0 -165
  66. data/ext/oci8/define.c +0 -53
  67. data/ext/oci8/describe.c +0 -81
  68. data/ext/oci8/descriptor.c +0 -39
  69. data/ext/oci8/handle.c +0 -273
  70. data/ext/oci8/oranumber.c +0 -445
  71. data/ext/oci8/param.c +0 -37
  72. data/ext/oci8/server.c +0 -182
  73. data/ext/oci8/session.c +0 -99
  74. data/ext/oci8/svcctx.c +0 -238
  75. data/ruby-oci8.spec +0 -62
  76. data/support/README +0 -4
  77. data/support/runit/assert.rb +0 -281
  78. data/support/runit/cui/testrunner.rb +0 -101
  79. data/support/runit/error.rb +0 -4
  80. data/support/runit/method_mappable.rb +0 -20
  81. data/support/runit/robserver.rb +0 -25
  82. data/support/runit/setuppable.rb +0 -15
  83. data/support/runit/teardownable.rb +0 -16
  84. data/support/runit/testcase.rb +0 -113
  85. data/support/runit/testfailure.rb +0 -25
  86. data/support/runit/testresult.rb +0 -121
  87. data/support/runit/testsuite.rb +0 -43
  88. data/support/runit/version.rb +0 -3
  89. data/test/test_describe.rb +0 -137
@@ -1,62 +0,0 @@
1
- %define ruby_sitelib %(ruby -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]')
2
- %define ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"]')
3
-
4
- Summary: ruby interface for Oracle using OCI8 API
5
- Name: ruby-oci8
6
- Version: 1.0.7
7
- Release: 1%{?dist}
8
- Group: Development/Libraries
9
- License: Ruby License
10
- URL: http://rubyforge.org/projects/ruby-oci8/
11
- Source0: %{name}-%{version}.tar.gz
12
- BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
13
- Requires: ruby
14
- Requires: oracle-instantclient-basic
15
- BuildRequires: ruby
16
- BuildRequires: ruby-devel
17
- BuildRequires: oracle-instantclient-basic
18
- BuildRequires: oracle-instantclient-devel
19
-
20
- # Note: the oracle-instanclient-basic package should say
21
- # Provides: libclntsh.so.10.1
22
- # but it doesn't. So we have to turn off dependency checking in the
23
- # finished package. (Or else we could manually patch the package
24
- # using rpmrebuild)
25
- AutoReqProv: no
26
-
27
- %description
28
- Ruby/OCI8 is a ruby interface for Oracle using OCI8 API. It also provides
29
- a DBD driver for use with ruby-dbi, and is used by the ActiveRecord Oracle
30
- connection adapter.
31
-
32
- %prep
33
- %setup -q -n %{name}-%{Version}
34
-
35
- %build
36
- CFLAGS="$RPM_OPT_FLAGS" \
37
- LD_LIBRARY_PATH="$(echo /usr/lib/oracle/*/client/lib | sed 's/^.* //')" \
38
- ruby setup.rb config -- --with-instant-client
39
- make
40
-
41
- %install
42
- rm -rf $RPM_BUILD_ROOT
43
- ruby setup.rb --verbose install --prefix=$RPM_BUILD_ROOT
44
-
45
- %clean
46
- rm -rf $RPM_BUILD_ROOT
47
-
48
- %files
49
- %defattr(-, root, root, -)
50
- %doc ChangeLog NEWS README
51
- %doc doc/api.en.html doc/manual.css
52
-
53
- %{ruby_sitelib}/oci8.rb
54
- %{ruby_sitelib}/DBD/OCI8/OCI8.rb
55
- %{ruby_sitearch}/oci8lib.so
56
-
57
- %changelog
58
- * Thu Jun 26 2008 KUBO Takehiro <kubo@jiubao.org>
59
- - Thie file is made from ruby-oci8.spec.in by erb.
60
-
61
- * Fri Mar 23 2007 Brian Candler <brian.candler@inspiredbroadcast.net> - 1.0.0_rc1-1
62
- - First cut
@@ -1,4 +0,0 @@
1
- This directory includes support files to run unit test.
2
-
3
- runit : minimum files which are copyed from RubyUnit 0.5.2.
4
- http://homepage1.nifty.com/markey/ruby/rubyunit/index_e.html
@@ -1,281 +0,0 @@
1
- require 'runit/version'
2
- require 'runit/error'
3
-
4
- module RUNIT
5
- module Assert
6
- @@run_asserts = 0
7
- @@skip_failure = false
8
-
9
- def Assert.skip_failure=(arg)
10
- @@skip_failure = arg
11
- end
12
-
13
- def Assert.skip_failure?
14
- @@skip_failure
15
- end
16
-
17
- def Assert.run_asserts
18
- @@run_asserts
19
- end
20
-
21
- def edit_message(msg)
22
- (msg != "")? msg + " " : msg
23
- end
24
- private :edit_message
25
-
26
- def build_message(msg, *args, &proc)
27
- str_args = args.collect {|arg|
28
- to_string(arg)
29
- }
30
- if block_given?
31
- edit_message(msg).concat proc.call(*str_args)
32
- else
33
- msg
34
- end
35
- end
36
- private :build_message
37
-
38
- def to_string(obj)
39
- case obj
40
- when Symbol
41
- obj.id2name
42
- when String
43
- obj
44
- else
45
- obj.inspect
46
- end
47
- end
48
- private :to_string
49
-
50
- def float_to_str(f, e)
51
- return f.to_s if e == 0
52
- i = 0
53
- while 1 > e
54
- i += 1
55
- e *= 10
56
- end
57
- i += 1
58
- sprintf("%.#{i}f", f)
59
- end
60
- private :float_to_str
61
-
62
- def raise_assertion_error(message)
63
- if Assert.skip_failure?
64
- changed
65
- err = AssertionFailedError.new(message)
66
- err.set_backtrace(caller)
67
- notify_observers(RObserver::ADD_FAILURE, caller, err, type)
68
- else
69
- raise AssertionFailedError, message
70
- end
71
- end
72
- private :raise_assertion_error
73
-
74
- def setup_assert
75
- @@run_asserts += 1
76
- end
77
-
78
- def assert(condition, message="")
79
- setup_assert
80
- if !condition.instance_of?(TrueClass) && !condition.instance_of?(FalseClass)
81
- raise TypeError, "1st argument <#{condition}> type should be TrueClass or FalseClass."
82
- end
83
- if !condition
84
- msg = build_message(message, condition) {|arg|
85
- "The condition is <#{arg}:#{condition.type.inspect}>"
86
- }
87
- raise_assertion_error(msg)
88
- end
89
- end
90
-
91
- def assert_equal(expected, actual, message="")
92
- setup_assert
93
- if expected != actual
94
- msg = build_message(message, expected, actual) {|arg1, arg2|
95
- "expected:<#{arg1}> but was:<#{arg2}>"
96
- }
97
- raise_assertion_error(msg)
98
- end
99
- end
100
- alias assert_equals assert_equal
101
-
102
- def assert_operator(obj1, op, obj2, message="")
103
- setup_assert
104
- if !obj1.send(op, obj2)
105
- msg = build_message(message, obj1, obj2) {|arg1, arg2|
106
- "The condition is not satisfied: #{arg1} #{op.to_s} #{arg2}"
107
- }
108
- raise_assertion_error(msg)
109
- end
110
- end
111
-
112
- def assert_equal_float(expected, actual, e, message="")
113
- setup_assert
114
- if e < 0.0
115
- raise ArgumentError, "#{e}: 3rd argument should be 0 or greater than 0."
116
- end
117
- if (expected - actual).abs > e
118
- msg = build_message(message) {
119
- "expected:<#{float_to_str(expected, e)}> but was:<#{float_to_str(actual, e)}>"
120
- }
121
- raise_assertion_error(msg)
122
- end
123
- end
124
-
125
- def assert_same(expected, actual, message="")
126
- setup_assert
127
- if !actual.equal?(expected)
128
- msg = build_message(message, actual, expected) {|arg1, arg2|
129
- "<#{arg1}:#{actual.type.inspect}> is not same object: <#{arg2}:#{expected.type.inspect}>"
130
- }
131
- raise_assertion_error(msg)
132
- end
133
- end
134
-
135
- def assert_send(obj, method, *args)
136
- setup_assert
137
- if !obj.send(method, *args)
138
- msg = "Assertion failed: #{obj.type.inspect}(#{obj.inspect})##{to_string(method)}"
139
- if args.size > 0
140
- strargs = args.collect {|arg|
141
- "<#{to_string(arg).inspect}:#{arg.type.inspect}>"
142
- }.join(", ")
143
- msg.concat "(#{strargs})"
144
- end
145
- raise_assertion_error(msg)
146
- end
147
- end
148
-
149
- def assert_nil(obj, message="")
150
- setup_assert
151
- if !obj.nil?
152
- msg = build_message(message, obj) {|arg|
153
- "<#{arg}:#{obj.type.inspect}> is not nil"
154
- }
155
- raise_assertion_error(msg)
156
- end
157
- end
158
-
159
- def assert_not_nil(obj, message="")
160
- setup_assert
161
- if obj.nil?
162
- msg = build_message(message) {
163
- "object is nil"
164
- }
165
- raise_assertion_error(msg)
166
- end
167
- end
168
-
169
- def assert_respond_to(method, obj, message="")
170
- setup_assert
171
- if !obj.respond_to?(method)
172
- msg = build_message(message, obj, method) {|arg1, arg2|
173
- "<#{arg1}:#{obj.type.inspect}> does not respond to <#{arg2}>"
174
- }
175
- raise_assertion_error(msg)
176
- end
177
- end
178
-
179
- def assert_kind_of(c, obj, message="")
180
- setup_assert
181
- if !obj.kind_of?(c)
182
- msg = build_message(message, obj, c) {|arg1, arg2|
183
- "<#{arg1}:#{obj.type.inspect}> is not kind of <#{arg2}>"
184
- }
185
- raise_assertion_error(msg)
186
- end
187
- end
188
-
189
- def assert_instance_of(c, obj, message="")
190
- setup_assert
191
- if !obj.instance_of?(c)
192
- msg = build_message(message, obj, c) {|arg1, arg2|
193
- "<#{arg1}:#{obj.type.inspect}> is not instance of <#{arg2}>"
194
- }
195
- raise_assertion_error(msg)
196
- end
197
- end
198
-
199
- def assert_match(str, re, message="")
200
- setup_assert
201
- if re !~ str
202
- msg = build_message(message, re, str) {|arg1, arg2|
203
- "<#{arg1}> not match <#{arg2}>"
204
- }
205
- raise_assertion_error(msg)
206
- end
207
- return Regexp.last_match
208
- end
209
- alias assert_matches assert_match
210
-
211
- def assert_not_match(str, re, message="")
212
- setup_assert
213
- if re =~ str
214
- match = Regexp.last_match
215
- msg = build_message(message, re, str) {|arg1, arg2|
216
- "<#{arg1}> matches '#{match[0]}' of <#{arg2}>"
217
- }
218
- raise_assertion_error(msg)
219
- end
220
- end
221
-
222
- def assert_exception(exception, message="")
223
- setup_assert
224
- exception_raised = true
225
- err = ""
226
- ret = nil
227
- begin
228
- yield
229
- exception_raised = false
230
- err = 'NO EXCEPTION RAISED'
231
- rescue Exception
232
- if $!.instance_of?(exception)
233
- exception_raised = true
234
- ret = $!
235
- else
236
- exception_raised = false
237
- err = $!.type
238
- end
239
- end
240
- if !exception_raised
241
- msg = build_message(message, exception, err) {|arg1, arg2|
242
- "expected:<#{arg1}> but was:<#{arg2}>"
243
- }
244
- raise_assertion_error(msg)
245
- end
246
- ret
247
- end
248
-
249
- def assert_no_exception(*arg)
250
- setup_assert
251
- message = ""
252
- if arg[arg.size-1].instance_of?(String)
253
- message = arg.pop
254
- end
255
- err = nil
256
- exception_raised = false
257
- begin
258
- yield
259
- rescue Exception
260
- if arg.include?($!.type) || arg.size == 0
261
- exception_raised = true
262
- err = $!
263
- else
264
- raise $!.type, $!.message, $!.backtrace
265
- end
266
- end
267
- if exception_raised
268
- msg = build_message(message, err) {|arg|
269
- "Exception raised:#{arg}"
270
- }
271
- raise_assertion_error(msg)
272
- end
273
- end
274
-
275
- def assert_fail(message)
276
- setup_assert
277
- raise_assertion_error message
278
- end
279
-
280
- end
281
- end
@@ -1,101 +0,0 @@
1
- require 'runit/testresult'
2
- require 'runit/robserver'
3
-
4
- module RUNIT
5
- module CUI
6
- class TestRunner
7
- include RObserver
8
- @@quiet_mode = false
9
- def initialize(io=STDERR, wait=false)
10
- @io = io
11
- @wait = wait
12
- end
13
-
14
- def TestRunner.quiet_mode=(flag)
15
- @@quiet_mode = flag
16
- end
17
-
18
- def TestRunner.run(test, io=STDERR, wait = false)
19
- r = TestRunner.new(io, wait)
20
- r.run(test)
21
- end
22
-
23
- def run(test)
24
- result = RUNIT::TestResult.new
25
- result.add_observer(self)
26
- test.run(result)
27
- print_running_time(result.running_time)
28
- print_result(result, test.count_test_cases)
29
- print_waiting_message
30
- result
31
- end
32
-
33
- def print_waiting_message
34
- if @wait
35
- STDERR.print "<RETURN> to Continue "
36
- STDIN.gets
37
- end
38
- end
39
-
40
- def print_running_time(rtm)
41
- @io.print "\nTime: #{rtm}\n"
42
- end
43
-
44
- def start_test(t)
45
- @io.print "\n", t.name , " " if !@@quiet_mode
46
- end
47
-
48
- def add_failure(at, err)
49
- @io.print("F")
50
- end
51
-
52
- def add_error(at, err)
53
- @io.print("E")
54
- end
55
-
56
- def end_test(t)
57
- @io.print(".")
58
- end
59
-
60
- def print_result(result, count)
61
- print_header(result, count)
62
- print_failures(result)
63
- print_errors(result)
64
- end
65
-
66
- def print_header(result, count)
67
- if result.succeed?
68
- @io.puts "OK (#{result.run_tests}/#{count} tests #{result.run_asserts} asserts)"
69
- else
70
- @io.puts "FAILURES!!!"
71
- @io.puts "Test Results:"
72
- @io.print " Run: #{result.run_tests}/#{count}(#{result.run_asserts} asserts)"
73
- @io.print " Failures: #{result.failure_size}"
74
- @io.puts " Errors: #{result.error_size}"
75
- end
76
- end
77
-
78
- def print_failures(result)
79
- @io.puts "Failures: #{result.failure_size}" if result.failure_size > 0
80
- result.failures.each do |f|
81
- @io.print f.at[0], ": ", f.err, " (", f.err.class, ")\n"
82
- for at in f.at[1..-1]
83
- @io.print "\tfrom ", at, "\n"
84
- end
85
- end
86
- end
87
-
88
- def print_errors(result)
89
- @io.puts "Errors: #{result.error_size}" if result.error_size > 0
90
- result.errors.each do |e|
91
- @io.print e.at[0], ": ", e.err, " (", e.err.class, ")\n"
92
- for at in e.at[1..-1]
93
- @io.print "\tfrom ", at, "\n"
94
- end
95
- end
96
- end
97
-
98
- end
99
- end
100
- end
101
-