|
117 | 117 | clob = OCI8::CLOB.new(@raw_conn, large_text) |
118 | 118 | expect(@conn.ora_value_to_ruby_value(clob)).to eq large_text |
119 | 119 | end |
120 | | - |
| 120 | + |
121 | 121 | end |
122 | 122 |
|
123 | 123 | # JRuby |
|
132 | 132 | it "should translate PL/SQL NUMBER to Ruby BigDecimal" do |
133 | 133 | expect(@conn.plsql_to_ruby_data_type(:data_type => "NUMBER", :data_length => 15)).to eq [BigDecimal, nil] |
134 | 134 | end |
135 | | - |
| 135 | + |
136 | 136 | it "should translate PL/SQL DATE to Ruby DateTime" do |
137 | 137 | expect(@conn.plsql_to_ruby_data_type(:data_type => "DATE", :data_length => nil)).to eq [DateTime, nil] |
138 | 138 | end |
139 | | - |
| 139 | + |
140 | 140 | it "should translate PL/SQL TIMESTAMP to Ruby Time" do |
141 | 141 | expect(@conn.plsql_to_ruby_data_type(:data_type => "TIMESTAMP", :data_length => nil)).to eq [Time, nil] |
142 | 142 | end |
143 | | - |
| 143 | + |
144 | 144 | it "should not translate Ruby Fixnum when BigDecimal type specified" do |
145 | 145 | expect(@conn.ruby_value_to_ora_value(100, BigDecimal)).to eq java.math.BigDecimal.new(100) |
146 | 146 | end |
147 | | - |
| 147 | + |
148 | 148 | it "should translate Ruby Bignum value to BigDecimal when BigDecimal type specified" do |
149 | 149 | big_decimal = @conn.ruby_value_to_ora_value(12345678901234567890, BigDecimal) |
150 | 150 | expect(big_decimal).to eq java.math.BigDecimal.new("12345678901234567890") |
|
167 | 167 | it "should translate Oracle BigDecimal integer value to Fixnum" do |
168 | 168 | expect(@conn.ora_value_to_ruby_value(BigDecimal("100"))).to eql(100) |
169 | 169 | end |
170 | | - |
| 170 | + |
171 | 171 | it "should translate Oracle BigDecimal float value to BigDecimal" do |
172 | 172 | expect(@conn.ora_value_to_ruby_value(BigDecimal("100.11"))).to eql(BigDecimal("100.11")) |
173 | 173 | end |
|
210 | 210 | expect(@conn.select_first("SELECT :1,:2,:3,:4,:5 FROM dual", |
211 | 211 | 'abc',123,123.456,@now,@today)).to eq ["abc",123,123.456,@now,Time.parse(@today.to_s)] |
212 | 212 | end |
213 | | - |
| 213 | + |
214 | 214 | it "should execute SQL statement with NULL values and return first result" do |
215 | 215 | @now = Time.local(2008,05,31,23,22,11) |
216 | 216 | expect(@conn.select_first("SELECT NULL,123,123.456, |
|
226 | 226 | expect(@conn.select_first("SELECT :1,:2,:3,:4,:5 FROM dual", |
227 | 227 | nil,123,123.456,@now,@today)).to eq [nil,123,123.456,@now,Time.parse(@today.to_s)] |
228 | 228 | end |
229 | | - |
| 229 | + |
230 | 230 | end |
231 | 231 |
|
232 | 232 | it "should execute SQL statement and return all results" do |
|
254 | 254 | expect(@conn.select_all("SELECT :1,:2,:3,:4 FROM dual UNION ALL SELECT :1,:2,:3,:4 FROM dual", |
255 | 255 | 'abc',123,123.456,@now,'abc',123,123.456,@now)).to eq [["abc",123,123.456,@now],["abc",123,123.456,@now]] |
256 | 256 | end |
257 | | - |
| 257 | + |
258 | 258 | it "should execute SQL statement and yield all results in block" do |
259 | 259 | @now = Time.local(2008,05,31,23,22,11) |
260 | 260 | expect(@conn.select_all("SELECT 'abc',123,123.456, |
|
266 | 266 | expect(r).to eq ["abc",123,123.456,@now] |
267 | 267 | end).to eq 2 |
268 | 268 | end |
269 | | - |
| 269 | + |
270 | 270 | it "should execute SQL statement with bind parameters and yield all results in block" do |
271 | 271 | @now = Time.local(2008,05,31,23,22,11) |
272 | 272 | expect(@conn.select_all("SELECT :1,:2,:3,:4 FROM dual UNION ALL SELECT :1,:2,:3,:4 FROM dual", |
|
276 | 276 | end |
277 | 277 |
|
278 | 278 | end |
279 | | - |
| 279 | + |
280 | 280 | describe "PL/SQL procedures" do |
281 | 281 | before(:all) do |
282 | 282 | @random = rand(1000) |
|
313 | 313 | expect(cursor[":p_date"]).to eq @now |
314 | 314 | expect(cursor.close).to be_nil |
315 | 315 | end |
316 | | - |
| 316 | + |
317 | 317 | end |
318 | | - |
| 318 | + |
319 | 319 | describe "commit and rollback" do |
320 | 320 | before(:all) do |
321 | 321 | expect(@conn.exec("CREATE TABLE test_commit (dummy VARCHAR2(100))")).to be true |
|
0 commit comments