fb 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/fb.c +1 -1
- data/test/ConnectionTestCases.rb +1 -4
- data/test/CursorTestCases.rb +5 -8
- data/test/DataTypesTestCases.rb +31 -36
- data/test/DatabaseTestCases.rb +4 -7
- data/test/EncodingTestCases.rb +1 -2
- data/test/FbTestCases.rb +19 -0
- data/test/FbTestSuite.rb +1 -1
- data/test/TransactionTestCases.rb +5 -8
- metadata +12 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 56b9a209c188f5a267c3dda503f72226a467eaa2
|
4
|
+
data.tar.gz: e443a11b2c99d410856eabdc463cf8146e9fb261
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b1d66d743e5649eb9fcf65406b8e1d78b747cac4e420867954b02b792875ddb2acf5b8c06a396d7c674869afdb2d0c24b4f903c940f062c8c622f1be24bbe1a
|
7
|
+
data.tar.gz: dda09a0abc589816ce41e88a13d40d335787ee9d9b6c3978f56f96b129fe1ca6b849e5e7d2955737c823cc40dac221b7197a6cd7e733b6e41c5f978f911af3a6
|
data/fb.c
CHANGED
@@ -2911,7 +2911,7 @@ static VALUE default_int(VALUE hash, const char *key, int def)
|
|
2911
2911
|
static VALUE database_allocate_instance(VALUE klass)
|
2912
2912
|
{
|
2913
2913
|
NEWOBJ(obj, struct RObject);
|
2914
|
-
OBJSETUP(obj, klass, T_OBJECT);
|
2914
|
+
OBJSETUP((VALUE)obj, klass, T_OBJECT);
|
2915
2915
|
return (VALUE)obj;
|
2916
2916
|
}
|
2917
2917
|
|
data/test/ConnectionTestCases.rb
CHANGED
data/test/CursorTestCases.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'test/unit'
|
2
1
|
require 'test/FbTestCases'
|
3
|
-
# require 'fb'
|
4
|
-
# include Fb
|
5
2
|
|
6
|
-
class CursorTestCases <
|
3
|
+
class CursorTestCases < FbTestCase
|
7
4
|
include FbTestCases
|
8
5
|
|
9
6
|
def test_fetch_array
|
@@ -153,19 +150,19 @@ class CursorTestCases < Test::Unit::TestCase
|
|
153
150
|
connection.execute("create generator test_seq");
|
154
151
|
connection.execute("select gen_id(test_seq, 1) from rdb$database") do |cursor|
|
155
152
|
r1 = cursor.fetch
|
156
|
-
|
153
|
+
assert !r1.nil?
|
157
154
|
r2 = cursor.fetch
|
158
155
|
assert_nil r2
|
159
|
-
|
156
|
+
assert_raises Error do
|
160
157
|
r3 = cursor.fetch
|
161
158
|
end
|
162
159
|
end
|
163
160
|
connection.execute("select * from rdb$database") do |cursor|
|
164
161
|
r1 = cursor.fetch
|
165
|
-
|
162
|
+
assert !r1.nil?
|
166
163
|
r2 = cursor.fetch
|
167
164
|
assert_nil r2
|
168
|
-
|
165
|
+
assert_raises Error do
|
169
166
|
r3 = cursor.fetch
|
170
167
|
end
|
171
168
|
end
|
data/test/DataTypesTestCases.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
|
-
require 'test/unit'
|
2
1
|
require 'test/FbTestCases'
|
3
|
-
# require 'fb'
|
4
|
-
# require 'date'
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
class DataTypesTestCases < Test::Unit::TestCase
|
3
|
+
class DataTypesTestCases < FbTestCase
|
9
4
|
include FbTestCases
|
10
5
|
|
11
6
|
def gen_i(i)
|
@@ -277,108 +272,108 @@ class DataTypesTestCases < Test::Unit::TestCase
|
|
277
272
|
cols.size.times do |i|
|
278
273
|
sql_insert = "INSERT INTO TEST_#{cols[i]} (VAL) VALUES (?);"
|
279
274
|
if cols[i] == 'I'
|
280
|
-
|
275
|
+
assert_raises TypeError do
|
281
276
|
connection.execute(sql_insert, {:five => "five"})
|
282
277
|
end
|
283
|
-
|
278
|
+
assert_raises TypeError do
|
284
279
|
connection.execute(sql_insert, Time.now)
|
285
280
|
end
|
286
|
-
|
281
|
+
assert_raises RangeError do
|
287
282
|
connection.execute(sql_insert, 5000000000)
|
288
283
|
end
|
289
284
|
elsif cols[i] == 'SI'
|
290
|
-
|
285
|
+
assert_raises TypeError do
|
291
286
|
connection.execute(sql_insert, {:five => "five"})
|
292
287
|
end
|
293
|
-
|
288
|
+
assert_raises TypeError do
|
294
289
|
connection.execute(sql_insert, Time.now)
|
295
290
|
end
|
296
|
-
|
291
|
+
assert_raises RangeError do
|
297
292
|
connection.execute(sql_insert, 100000)
|
298
293
|
end
|
299
294
|
elsif cols[i] == 'BI'
|
300
|
-
|
295
|
+
assert_raises TypeError do
|
301
296
|
connection.execute(sql_insert, {:five => "five"})
|
302
297
|
end
|
303
|
-
|
298
|
+
assert_raises TypeError do
|
304
299
|
connection.execute(sql_insert, Time.now)
|
305
300
|
end
|
306
|
-
|
301
|
+
assert_raises RangeError do
|
307
302
|
connection.execute(sql_insert, 184467440737095516160) # 2^64 * 10
|
308
303
|
end
|
309
304
|
elsif cols[i] == 'F'
|
310
|
-
|
305
|
+
assert_raises TypeError do
|
311
306
|
connection.execute(sql_insert, {:five => "five"})
|
312
307
|
end
|
313
|
-
|
308
|
+
assert_raises RangeError do
|
314
309
|
connection.execute(sql_insert, 10 ** 39)
|
315
310
|
end
|
316
311
|
elsif cols[i] == 'D'
|
317
|
-
|
312
|
+
assert_raises TypeError do
|
318
313
|
connection.execute(sql_insert, {:five => "five"})
|
319
314
|
end
|
320
315
|
elsif cols[i] == 'VC'
|
321
|
-
|
316
|
+
assert_raises RangeError do
|
322
317
|
connection.execute(sql_insert, "too long")
|
323
318
|
end
|
324
|
-
|
319
|
+
assert_raises RangeError do
|
325
320
|
connection.execute(sql_insert, 1.0/3.0)
|
326
321
|
end
|
327
322
|
elsif cols[i] == 'VC10'
|
328
|
-
|
323
|
+
assert_raises RangeError do
|
329
324
|
connection.execute(sql_insert, 1.0/3.0)
|
330
325
|
end
|
331
326
|
elsif cols[i].include?('VC10000')
|
332
|
-
|
327
|
+
assert_raises RangeError do
|
333
328
|
connection.execute(sql_insert, "X" * 10001)
|
334
329
|
end
|
335
330
|
elsif cols[i] == 'C'
|
336
|
-
|
331
|
+
assert_raises RangeError do
|
337
332
|
connection.execute(sql_insert, "too long")
|
338
333
|
end
|
339
334
|
elsif cols[i] == 'C10'
|
340
|
-
|
335
|
+
assert_raises RangeError do
|
341
336
|
connection.execute(sql_insert, Time.now)
|
342
337
|
end
|
343
338
|
elsif cols[i] == 'DT'
|
344
|
-
|
339
|
+
assert_raises ArgumentError do
|
345
340
|
connection.execute(sql_insert, Date)
|
346
341
|
end
|
347
|
-
|
342
|
+
assert_raises ArgumentError do
|
348
343
|
connection.execute(sql_insert, 2006)
|
349
344
|
end
|
350
345
|
elsif cols[i] == 'TM'
|
351
|
-
|
346
|
+
assert_raises TypeError do
|
352
347
|
connection.execute(sql_insert, {:date => "2006/1/1"})
|
353
348
|
end
|
354
|
-
|
349
|
+
assert_raises TypeError do
|
355
350
|
connection.execute(sql_insert, 10000)
|
356
351
|
end
|
357
352
|
elsif cols[i] == 'TS'
|
358
|
-
|
353
|
+
assert_raises TypeError do
|
359
354
|
connection.execute(sql_insert, 5.5)
|
360
355
|
end
|
361
|
-
|
356
|
+
assert_raises TypeError do
|
362
357
|
connection.execute(sql_insert, 10000)
|
363
358
|
end
|
364
359
|
elsif cols[i] == 'N92'
|
365
|
-
|
360
|
+
assert_raises TypeError do
|
366
361
|
connection.execute(sql_insert, {:five => "five"})
|
367
362
|
end
|
368
|
-
|
363
|
+
assert_raises TypeError do
|
369
364
|
connection.execute(sql_insert, Time.now)
|
370
365
|
end
|
371
|
-
|
366
|
+
assert_raises RangeError do
|
372
367
|
connection.execute(sql_insert, 5000000000)
|
373
368
|
end
|
374
369
|
elsif cols[i] == 'D92'
|
375
|
-
|
370
|
+
assert_raises TypeError do
|
376
371
|
connection.execute(sql_insert, {:five => "five"})
|
377
372
|
end
|
378
|
-
|
373
|
+
assert_raises TypeError do
|
379
374
|
connection.execute(sql_insert, Time.now)
|
380
375
|
end
|
381
|
-
|
376
|
+
assert_raises RangeError do
|
382
377
|
connection.execute(sql_insert, 5000000000)
|
383
378
|
end
|
384
379
|
end
|
data/test/DatabaseTestCases.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'test/unit'
|
2
1
|
require 'test/FbTestCases'
|
3
|
-
# require 'fb'
|
4
|
-
# include Fb
|
5
2
|
|
6
|
-
class DatabaseTestCases <
|
3
|
+
class DatabaseTestCases < FbTestCase
|
7
4
|
include FbTestCases
|
8
5
|
|
9
6
|
def setup
|
@@ -110,13 +107,13 @@ class DatabaseTestCases < Test::Unit::TestCase
|
|
110
107
|
end
|
111
108
|
|
112
109
|
def test_create_bad_param
|
113
|
-
|
110
|
+
assert_raises TypeError do
|
114
111
|
db = Database.create(1)
|
115
112
|
end
|
116
113
|
end
|
117
114
|
|
118
115
|
def test_create_bad_page_size
|
119
|
-
|
116
|
+
assert_raises Error do
|
120
117
|
db = Database.create(@parms.merge(:page_size => 1000))
|
121
118
|
end
|
122
119
|
end
|
@@ -161,7 +158,7 @@ class DatabaseTestCases < Test::Unit::TestCase
|
|
161
158
|
connection.execute("insert into test values (1, 'test role')")
|
162
159
|
end
|
163
160
|
Database.connect(@reader) do |connection|
|
164
|
-
|
161
|
+
assert_raises Error do
|
165
162
|
connection.execute("select * from test") do |cursor|
|
166
163
|
flunk "Should not reach here."
|
167
164
|
end
|
data/test/EncodingTestCases.rb
CHANGED
data/test/FbTestCases.rb
CHANGED
@@ -2,6 +2,25 @@ require 'fileutils'
|
|
2
2
|
include FileUtils
|
3
3
|
require 'fb'
|
4
4
|
|
5
|
+
if RUBY_VERSION =~ /^2/
|
6
|
+
require 'minitest/autorun'
|
7
|
+
|
8
|
+
unless Minitest.const_defined?('Test')
|
9
|
+
Minitest::Test = MiniTest::Unit::TestCase
|
10
|
+
end
|
11
|
+
|
12
|
+
class FbTestCase < Minitest::Test
|
13
|
+
end
|
14
|
+
|
15
|
+
else
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class FbTestCase < Test::Unit::TestCase
|
19
|
+
def default_test
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
5
24
|
module FbTestCases
|
6
25
|
include Fb
|
7
26
|
|
data/test/FbTestSuite.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'test/unit'
|
2
1
|
require 'test/FbTestCases'
|
3
|
-
# require 'fb'
|
4
|
-
# include Fb
|
5
2
|
|
6
|
-
class TransactionTestCases <
|
3
|
+
class TransactionTestCases < FbTestCase
|
7
4
|
include FbTestCases
|
8
5
|
|
9
6
|
def test_transaction
|
@@ -30,7 +27,7 @@ class TransactionTestCases < Test::Unit::TestCase
|
|
30
27
|
assert connection.transaction_started
|
31
28
|
end
|
32
29
|
assert !connection.transaction_started
|
33
|
-
|
30
|
+
assert_raises RuntimeError do
|
34
31
|
connection.transaction do
|
35
32
|
assert connection.transaction_started
|
36
33
|
raise "generic exception"
|
@@ -45,7 +42,7 @@ class TransactionTestCases < Test::Unit::TestCase
|
|
45
42
|
sql_select = "SELECT * FROM RDB$DATABASE"
|
46
43
|
Database.create(@parms) do |connection|
|
47
44
|
assert !connection.transaction_started
|
48
|
-
|
45
|
+
assert_raises RuntimeError do
|
49
46
|
connection.execute(sql_select) do |cursor|
|
50
47
|
assert connection.transaction_started
|
51
48
|
raise "abort"
|
@@ -64,7 +61,7 @@ class TransactionTestCases < Test::Unit::TestCase
|
|
64
61
|
assert !connection.transaction_started
|
65
62
|
connection.execute(sql_insert, 1, "one")
|
66
63
|
assert !connection.transaction_started
|
67
|
-
|
64
|
+
assert_raises Error do
|
68
65
|
connection.execute(sql_insert, 1, "two")
|
69
66
|
end
|
70
67
|
assert !connection.transaction_started, "transaction is active"
|
@@ -165,7 +162,7 @@ class TransactionTestCases < Test::Unit::TestCase
|
|
165
162
|
Database.create(@parms) do |connection|
|
166
163
|
connection.execute(sql_schema)
|
167
164
|
assert !connection.transaction_started
|
168
|
-
|
165
|
+
assert_raises RuntimeError do
|
169
166
|
connection.transaction do
|
170
167
|
10.times do |i|
|
171
168
|
connection.execute(sql_insert, i, i.to_s);
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brent Rowland
|
@@ -19,14 +18,14 @@ extensions:
|
|
19
18
|
extra_rdoc_files:
|
20
19
|
- README
|
21
20
|
files:
|
21
|
+
- README
|
22
22
|
- extconf.rb
|
23
23
|
- fb.c
|
24
|
-
- README
|
25
24
|
- fb_extensions.rb
|
26
25
|
- test/ConnectionTestCases.rb
|
27
26
|
- test/CursorTestCases.rb
|
28
|
-
- test/DatabaseTestCases.rb
|
29
27
|
- test/DataTypesTestCases.rb
|
28
|
+
- test/DatabaseTestCases.rb
|
30
29
|
- test/EncodingTestCases.rb
|
31
30
|
- test/FbTestCases.rb
|
32
31
|
- test/FbTestSuite.rb
|
@@ -34,34 +33,33 @@ files:
|
|
34
33
|
homepage: http://github.com/rowland/fb
|
35
34
|
licenses:
|
36
35
|
- MIT
|
36
|
+
metadata: {}
|
37
37
|
post_install_message:
|
38
38
|
rdoc_options:
|
39
|
-
- --title
|
39
|
+
- "--title"
|
40
40
|
- Fb -- Ruby Firebird Extension
|
41
|
-
- --main
|
41
|
+
- "--main"
|
42
42
|
- README
|
43
|
-
- -x
|
43
|
+
- "-x"
|
44
44
|
- test
|
45
45
|
require_paths:
|
46
|
-
- .
|
46
|
+
- "."
|
47
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
48
|
requirements:
|
50
|
-
- -
|
49
|
+
- - ">="
|
51
50
|
- !ruby/object:Gem::Version
|
52
51
|
version: '0'
|
53
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
53
|
requirements:
|
56
|
-
- -
|
54
|
+
- - ">="
|
57
55
|
- !ruby/object:Gem::Version
|
58
56
|
version: '0'
|
59
57
|
requirements:
|
60
58
|
- Firebird client library fbclient.dll, libfbclient.so or Firebird.framework.
|
61
59
|
rubyforge_project:
|
62
|
-
rubygems_version:
|
60
|
+
rubygems_version: 2.2.0
|
63
61
|
signing_key:
|
64
|
-
specification_version:
|
62
|
+
specification_version: 4
|
65
63
|
summary: Firebird database driver
|
66
64
|
test_files:
|
67
65
|
- test/FbTestSuite.rb
|