fireruby 0.4.1-mswin32 → 0.4.2-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/doc/README +456 -456
  2. data/doc/license.txt +411 -411
  3. data/examples/example01.rb +65 -65
  4. data/lib/SQLType.rb +223 -227
  5. data/lib/fireruby.rb +22 -22
  6. data/lib/fr_lib.so +0 -0
  7. data/lib/mkdoc +1 -1
  8. data/lib/src.rb +1795 -1795
  9. data/test/AddRemoveUserTest.rb +56 -55
  10. data/test/BackupRestoreTest.rb +99 -99
  11. data/test/BlobTest.rb +57 -0
  12. data/test/CharacterSetTest.rb +63 -63
  13. data/test/ConnectionTest.rb +111 -111
  14. data/test/DDLTest.rb +54 -54
  15. data/test/DatabaseTest.rb +83 -83
  16. data/test/GeneratorTest.rb +50 -50
  17. data/test/KeyTest.rb +140 -140
  18. data/test/ResultSetTest.rb +162 -162
  19. data/test/RoleTest.rb +73 -0
  20. data/test/RowCountTest.rb +65 -65
  21. data/test/RowTest.rb +203 -203
  22. data/test/SQLTest.rb +182 -182
  23. data/test/SQLTypeTest.rb +101 -101
  24. data/test/ServiceManagerTest.rb +29 -29
  25. data/test/StatementTest.rb +135 -135
  26. data/test/TestSetup.rb +11 -11
  27. data/test/TransactionTest.rb +112 -112
  28. data/test/TypeTest.rb +92 -92
  29. data/test/UnitTest.rb +65 -64
  30. metadata +49 -110
  31. data/doc/CVS/Entries +0 -3
  32. data/doc/CVS/Entries.Log +0 -2
  33. data/doc/CVS/Repository +0 -1
  34. data/doc/CVS/Root +0 -1
  35. data/doc/classes/CVS/Entries +0 -1
  36. data/doc/classes/CVS/Entries.Log +0 -1
  37. data/doc/classes/CVS/Repository +0 -1
  38. data/doc/classes/CVS/Root +0 -1
  39. data/doc/classes/FireRuby/CVS/Entries +0 -1
  40. data/doc/classes/FireRuby/CVS/Entries.Log +0 -7
  41. data/doc/classes/FireRuby/CVS/Repository +0 -1
  42. data/doc/classes/FireRuby/CVS/Root +0 -1
  43. data/doc/classes/FireRuby/Connection.src/CVS/Entries +0 -1
  44. data/doc/classes/FireRuby/Connection.src/CVS/Repository +0 -1
  45. data/doc/classes/FireRuby/Connection.src/CVS/Root +0 -1
  46. data/doc/classes/FireRuby/Database.src/CVS/Entries +0 -1
  47. data/doc/classes/FireRuby/Database.src/CVS/Repository +0 -1
  48. data/doc/classes/FireRuby/Database.src/CVS/Root +0 -1
  49. data/doc/classes/FireRuby/FireRubyError.src/CVS/Entries +0 -1
  50. data/doc/classes/FireRuby/FireRubyError.src/CVS/Repository +0 -1
  51. data/doc/classes/FireRuby/FireRubyError.src/CVS/Root +0 -1
  52. data/doc/classes/FireRuby/Generator.src/CVS/Entries +0 -1
  53. data/doc/classes/FireRuby/Generator.src/CVS/Repository +0 -1
  54. data/doc/classes/FireRuby/Generator.src/CVS/Root +0 -1
  55. data/doc/classes/FireRuby/ResultSet.src/CVS/Entries +0 -1
  56. data/doc/classes/FireRuby/ResultSet.src/CVS/Repository +0 -1
  57. data/doc/classes/FireRuby/ResultSet.src/CVS/Root +0 -1
  58. data/doc/classes/FireRuby/Statement.src/CVS/Entries +0 -1
  59. data/doc/classes/FireRuby/Statement.src/CVS/Repository +0 -1
  60. data/doc/classes/FireRuby/Statement.src/CVS/Root +0 -1
  61. data/doc/classes/FireRuby/Transaction.src/CVS/Entries +0 -1
  62. data/doc/classes/FireRuby/Transaction.src/CVS/Repository +0 -1
  63. data/doc/classes/FireRuby/Transaction.src/CVS/Root +0 -1
  64. data/doc/files/CVS/Entries +0 -1
  65. data/doc/files/CVS/Repository +0 -1
  66. data/doc/files/CVS/Root +0 -1
  67. data/examples/CVS/Entries +0 -2
  68. data/examples/CVS/Repository +0 -1
  69. data/examples/CVS/Root +0 -1
  70. data/lib/CVS/Entries +0 -6
  71. data/lib/CVS/Repository +0 -1
  72. data/lib/CVS/Root +0 -1
  73. data/test/CVS/Entries +0 -20
  74. data/test/CVS/Repository +0 -1
  75. data/test/CVS/Root +0 -1
@@ -1,29 +1,29 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'TestSetup'
4
- require 'test/unit'
5
- require 'rubygems'
6
- require 'fireruby'
7
-
8
- include FireRuby
9
-
10
- class ServiceManagerTest < Test::Unit::TestCase
11
- def setup
12
- puts "#{self.class.name} started." if TEST_LOGGING
13
- end
14
-
15
- def teardown
16
- puts "#{self.class.name} finished." if TEST_LOGGING
17
- end
18
-
19
- def test01
20
- sm = ServiceManager.new('localhost')
21
- assert(sm.connected? == false)
22
-
23
- assert(sm.connect(DB_USER_NAME, DB_PASSWORD) == sm)
24
- assert(sm.connected?)
25
-
26
- assert(sm.disconnect == sm)
27
- assert(sm.connected? == false)
28
- end
29
- end
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'TestSetup'
4
+ require 'test/unit'
5
+ require 'rubygems'
6
+ require 'fireruby'
7
+
8
+ include FireRuby
9
+
10
+ class ServiceManagerTest < Test::Unit::TestCase
11
+ def setup
12
+ puts "#{self.class.name} started." if TEST_LOGGING
13
+ end
14
+
15
+ def teardown
16
+ puts "#{self.class.name} finished." if TEST_LOGGING
17
+ end
18
+
19
+ def test01
20
+ sm = ServiceManager.new('localhost')
21
+ assert(sm.connected? == false)
22
+
23
+ assert(sm.connect(DB_USER_NAME, DB_PASSWORD) == sm)
24
+ assert(sm.connected?)
25
+
26
+ assert(sm.disconnect == sm)
27
+ assert(sm.connected? == false)
28
+ end
29
+ end
@@ -1,135 +1,135 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'TestSetup'
4
- require 'test/unit'
5
- require 'rubygems'
6
- require 'fireruby'
7
-
8
- include FireRuby
9
-
10
- class StatementTest < Test::Unit::TestCase
11
- CURDIR = "#{Dir.getwd}"
12
- DB_FILE = "#{CURDIR}#{File::SEPARATOR}stmt_unit_test.fdb"
13
-
14
- def setup
15
- puts "#{self.class.name} started." if TEST_LOGGING
16
- if File::exist?(DB_FILE)
17
- Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
18
- end
19
- @database = Database::create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
20
- @connections = []
21
- @transactions = []
22
- end
23
-
24
- def teardown
25
- @transactions.each do |tx|
26
- tx.rollback if tx.active?
27
- end
28
- @transactions.clear
29
- @connections.each do |cxn|
30
- cxn.close if cxn.open?
31
- end
32
- @connections.clear
33
- if File::exist?(DB_FILE)
34
- Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
35
- end
36
- puts "#{self.class.name} finished." if TEST_LOGGING
37
- end
38
-
39
- def test01
40
- @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
41
- @transactions.push(@connections.last.start_transaction)
42
-
43
- s1 = Statement.new(@connections[0],
44
- @transactions[0],
45
- "SELECT RDB$FIELD_NAME FROM RDB$FIELDS", 3)
46
- assert(s1 != nil)
47
- assert(s1.sql == "SELECT RDB$FIELD_NAME FROM RDB$FIELDS")
48
- assert(s1.connection == @connections[0])
49
- assert(s1.transaction == @transactions[0])
50
- assert(s1.dialect == 3)
51
- assert(s1.type == Statement::SELECT_STATEMENT)
52
- s1.close
53
-
54
- s2 = Statement.new(@connections[0],
55
- @transactions[0],
56
- "DELETE FROM RDB$EXCEPTIONS", 1)
57
- assert(s2 != nil)
58
- assert(s2.sql == "DELETE FROM RDB$EXCEPTIONS")
59
- assert(s2.connection == @connections[0])
60
- assert(s2.transaction == @transactions[0])
61
- assert(s2.dialect == 1)
62
- assert(s2.type == Statement::DELETE_STATEMENT)
63
- s2.close
64
- end
65
-
66
- def test02
67
- @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
68
- @transactions.push(@connections[0].start_transaction)
69
-
70
- s = Statement.new(@connections[0], @transactions[0],
71
- "SELECT RDB$FIELD_NAME FROM RDB$FIELDS "\
72
- "WHERE RDB$FIELD_NAME LIKE ?", 3)
73
-
74
- begin
75
- r = s.execute
76
- r.close
77
- assert(false,
78
- "Executed statement that required parameter without the "\
79
- "parameter being specified.")
80
- rescue Exception => error
81
- end
82
-
83
- begin
84
- r = s.execute_for([])
85
- r.close
86
- assert(false,
87
- "Executed statement that required a parameter with an empty "\
88
- "parameter set.")
89
- rescue Exception => error
90
- end
91
-
92
- begin
93
- r = s.execute_for(['LALALA', 25])
94
- r.close
95
- assert(false,
96
- "Executed statement that required a parameter with too many "\
97
- "parameters.")
98
- rescue Exception => error
99
- end
100
-
101
- r = s.execute_for(['LALALA'])
102
- assert(r != nil)
103
- assert(r.class == ResultSet)
104
- r.close
105
-
106
- total = 0
107
- s.execute_for(["%"]) do |row|
108
- total = total + 1
109
- end
110
- assert(total = 88)
111
- s.close
112
- end
113
-
114
- def test03
115
- d = nil
116
- @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
117
- cxn.execute_immediate('CREATE TABLE STRING_TEST(TEXT VARCHAR(10))')
118
- cxn.start_transaction do |tx|
119
- # Perform an truncated insert.
120
- s = Statement.new(cxn, tx, 'INSERT INTO STRING_TEST VALUES(?)', 3)
121
- s.execute_for(['012345678901234'])
122
-
123
- # Perform a select of the value inserted.
124
- r = cxn.execute('SELECT * FROM STRING_TEST', tx)
125
- d = r.fetch
126
-
127
- # Clean up.
128
- s.close
129
- r.close
130
- end
131
- assert(d[0] == '0123456789')
132
- cxn.execute_immediate('DROP TABLE STRING_TEST')
133
- end
134
- end
135
- end
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'TestSetup'
4
+ require 'test/unit'
5
+ require 'rubygems'
6
+ require 'fireruby'
7
+
8
+ include FireRuby
9
+
10
+ class StatementTest < Test::Unit::TestCase
11
+ CURDIR = "#{Dir.getwd}"
12
+ DB_FILE = "#{CURDIR}#{File::SEPARATOR}stmt_unit_test.fdb"
13
+
14
+ def setup
15
+ puts "#{self.class.name} started." if TEST_LOGGING
16
+ if File::exist?(DB_FILE)
17
+ Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
18
+ end
19
+ @database = Database::create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
20
+ @connections = []
21
+ @transactions = []
22
+ end
23
+
24
+ def teardown
25
+ @transactions.each do |tx|
26
+ tx.rollback if tx.active?
27
+ end
28
+ @transactions.clear
29
+ @connections.each do |cxn|
30
+ cxn.close if cxn.open?
31
+ end
32
+ @connections.clear
33
+ if File::exist?(DB_FILE)
34
+ Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
35
+ end
36
+ puts "#{self.class.name} finished." if TEST_LOGGING
37
+ end
38
+
39
+ def test01
40
+ @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
41
+ @transactions.push(@connections.last.start_transaction)
42
+
43
+ s1 = Statement.new(@connections[0],
44
+ @transactions[0],
45
+ "SELECT RDB$FIELD_NAME FROM RDB$FIELDS", 3)
46
+ assert(s1 != nil)
47
+ assert(s1.sql == "SELECT RDB$FIELD_NAME FROM RDB$FIELDS")
48
+ assert(s1.connection == @connections[0])
49
+ assert(s1.transaction == @transactions[0])
50
+ assert(s1.dialect == 3)
51
+ assert(s1.type == Statement::SELECT_STATEMENT)
52
+ s1.close
53
+
54
+ s2 = Statement.new(@connections[0],
55
+ @transactions[0],
56
+ "DELETE FROM RDB$EXCEPTIONS", 1)
57
+ assert(s2 != nil)
58
+ assert(s2.sql == "DELETE FROM RDB$EXCEPTIONS")
59
+ assert(s2.connection == @connections[0])
60
+ assert(s2.transaction == @transactions[0])
61
+ assert(s2.dialect == 1)
62
+ assert(s2.type == Statement::DELETE_STATEMENT)
63
+ s2.close
64
+ end
65
+
66
+ def test02
67
+ @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
68
+ @transactions.push(@connections[0].start_transaction)
69
+
70
+ s = Statement.new(@connections[0], @transactions[0],
71
+ "SELECT RDB$FIELD_NAME FROM RDB$FIELDS "\
72
+ "WHERE RDB$FIELD_NAME LIKE ?", 3)
73
+
74
+ begin
75
+ r = s.execute
76
+ r.close
77
+ assert(false,
78
+ "Executed statement that required parameter without the "\
79
+ "parameter being specified.")
80
+ rescue Exception => error
81
+ end
82
+
83
+ begin
84
+ r = s.execute_for([])
85
+ r.close
86
+ assert(false,
87
+ "Executed statement that required a parameter with an empty "\
88
+ "parameter set.")
89
+ rescue Exception => error
90
+ end
91
+
92
+ begin
93
+ r = s.execute_for(['LALALA', 25])
94
+ r.close
95
+ assert(false,
96
+ "Executed statement that required a parameter with too many "\
97
+ "parameters.")
98
+ rescue Exception => error
99
+ end
100
+
101
+ r = s.execute_for(['LALALA'])
102
+ assert(r != nil)
103
+ assert(r.class == ResultSet)
104
+ r.close
105
+
106
+ total = 0
107
+ s.execute_for(["%"]) do |row|
108
+ total = total + 1
109
+ end
110
+ assert(total = 88)
111
+ s.close
112
+ end
113
+
114
+ def test03
115
+ d = nil
116
+ @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
117
+ cxn.execute_immediate('CREATE TABLE STRING_TEST(TEXT VARCHAR(10))')
118
+ cxn.start_transaction do |tx|
119
+ # Perform an truncated insert.
120
+ s = Statement.new(cxn, tx, 'INSERT INTO STRING_TEST VALUES(?)', 3)
121
+ s.execute_for(['012345678901234'])
122
+
123
+ # Perform a select of the value inserted.
124
+ r = cxn.execute('SELECT * FROM STRING_TEST', tx)
125
+ d = r.fetch
126
+
127
+ # Clean up.
128
+ s.close
129
+ r.close
130
+ end
131
+ assert(d[0] == '0123456789')
132
+ cxn.execute_immediate('DROP TABLE STRING_TEST')
133
+ end
134
+ end
135
+ end
data/test/TestSetup.rb CHANGED
@@ -1,11 +1,11 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Add extra search paths.
4
- basedir = File::dirname(Dir.getwd)
5
- $:.push(basedir)
6
- $:.push("#{basedir}#{File::SEPARATOR}test")
7
- $:.push("#{basedir}#{File::SEPARATOR}lib")
8
-
9
- DB_USER_NAME = 'sysdba'
10
- DB_PASSWORD = 'masterkey'
11
- TEST_LOGGING = false
1
+ #!/usr/bin/env ruby
2
+
3
+ # Add extra search paths.
4
+ basedir = File::dirname(Dir.getwd)
5
+ $:.push(basedir)
6
+ $:.push("#{basedir}#{File::SEPARATOR}test")
7
+ $:.push("#{basedir}#{File::SEPARATOR}lib")
8
+
9
+ DB_USER_NAME = 'sysdba'
10
+ DB_PASSWORD = 'masterkey'
11
+ TEST_LOGGING = false
@@ -1,112 +1,112 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'TestSetup'
4
- require 'test/unit'
5
- require 'rubygems'
6
- require 'fireruby'
7
-
8
- include FireRuby
9
-
10
- class TransactionTest < Test::Unit::TestCase
11
- CURDIR = "#{Dir.getwd}"
12
- DB_FILE = "#{CURDIR}#{File::SEPARATOR}tx_unit_test.fdb"
13
-
14
- def setup
15
- puts "#{self.class.name} started." if TEST_LOGGING
16
- if File::exist?(DB_FILE)
17
- Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
18
- end
19
-
20
- @database = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
21
- @connections = []
22
- @transactions = []
23
-
24
- @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
25
- @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
26
- @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
27
- end
28
-
29
- def teardown
30
- @transactions.each do |tx|
31
- tx.rollback if tx.active?
32
- end
33
- @transactions.clear
34
- @connections.each do |cxn|
35
- cxn.close if cxn.open?
36
- end
37
- if File::exist?(DB_FILE)
38
- Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
39
- end
40
- puts "#{self.class.name} finished." if TEST_LOGGING
41
- end
42
-
43
- def test01
44
- @transactions.push(@connections[0].start_transaction)
45
- assert(@transactions[0].active?)
46
-
47
- @transactions.push(Transaction.new(@connections[1]))
48
- assert(@transactions[1].active?)
49
-
50
- assert(@transactions[0].connections == [@connections[0]])
51
- assert(@transactions[1].connections == [@connections[1]])
52
-
53
- assert(@transactions[0].for_connection?(@connections[1]) == false)
54
- assert(@transactions[1].for_connection?(@connections[0]) == false)
55
- assert(@transactions[0].for_connection?(@connections[0]))
56
- assert(@transactions[1].for_connection?(@connections[1]))
57
-
58
- @transactions[0].commit
59
- assert(@transactions[0].active? == false)
60
- assert(@transactions[0].connections == [])
61
- assert(@transactions[0].for_connection?(@connections[0]) == false)
62
- assert(@transactions[0].for_connection?(@connections[1]) == false)
63
-
64
- @transactions[1].rollback
65
- assert(@transactions[1].active? == false)
66
- assert(@transactions[1].connections == [])
67
- assert(@transactions[1].for_connection?(@connections[0]) == false)
68
- assert(@transactions[1].for_connection?(@connections[1]) == false)
69
-
70
- @transactions[0] = Transaction.new([@connections[0], @connections[1]])
71
- assert(@transactions[0].active? == true)
72
- assert(@transactions[0].for_connection?(@connections[0]))
73
- assert(@transactions[0].for_connection?(@connections[1]))
74
- assert(@transactions[0].for_connection?(@connections[2]) == false)
75
-
76
- @transactions[0].commit
77
- assert(@transactions[0].active? == false)
78
- assert(@transactions[0].connections == [])
79
- assert(@transactions[0].for_connection?(@connections[0]) == false)
80
- assert(@transactions[0].for_connection?(@connections[1]) == false)
81
- assert(@transactions[0].for_connection?(@connections[2]) == false)
82
-
83
- @transactions[0] = Transaction.new([@connections[0], @connections[2]])
84
- assert(@transactions[0].active?)
85
- @transactions[0].rollback
86
- assert(@transactions[0].active? == false)
87
- assert(@transactions[0].connections == [])
88
- assert(@transactions[0].for_connection?(@connections[0]) == false)
89
- assert(@transactions[0].for_connection?(@connections[1]) == false)
90
- assert(@transactions[0].for_connection?(@connections[2]) == false)
91
- end
92
-
93
- def test02
94
- sql = []
95
- sql.push("UPDATE RDB$EXCEPTIONS SET RDB$MESSAGE = 'WoooHooo'"\
96
- "WHERE RDB$EXCEPTION_NAME = 'Lalala'")
97
- sql.push("SELECT RDB$FIELD_NAME FROM RDB$FIELDS")
98
- @transactions.push(Transaction.new(@connections[0]))
99
-
100
- assert(@transactions[0].execute(sql[0]) == 0)
101
- r = @transactions[0].execute(sql[1])
102
- assert(r != nil)
103
- assert(r.class == ResultSet)
104
- r.close
105
-
106
- total = 0
107
- @transactions[0].execute(sql[1]) do |row|
108
- total += 1
109
- end
110
- assert(total == 88)
111
- end
112
- end
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'TestSetup'
4
+ require 'test/unit'
5
+ require 'rubygems'
6
+ require 'fireruby'
7
+
8
+ include FireRuby
9
+
10
+ class TransactionTest < Test::Unit::TestCase
11
+ CURDIR = "#{Dir.getwd}"
12
+ DB_FILE = "#{CURDIR}#{File::SEPARATOR}tx_unit_test.fdb"
13
+
14
+ def setup
15
+ puts "#{self.class.name} started." if TEST_LOGGING
16
+ if File::exist?(DB_FILE)
17
+ Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
18
+ end
19
+
20
+ @database = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
21
+ @connections = []
22
+ @transactions = []
23
+
24
+ @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
25
+ @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
26
+ @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
27
+ end
28
+
29
+ def teardown
30
+ @transactions.each do |tx|
31
+ tx.rollback if tx.active?
32
+ end
33
+ @transactions.clear
34
+ @connections.each do |cxn|
35
+ cxn.close if cxn.open?
36
+ end
37
+ if File::exist?(DB_FILE)
38
+ Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
39
+ end
40
+ puts "#{self.class.name} finished." if TEST_LOGGING
41
+ end
42
+
43
+ def test01
44
+ @transactions.push(@connections[0].start_transaction)
45
+ assert(@transactions[0].active?)
46
+
47
+ @transactions.push(Transaction.new(@connections[1]))
48
+ assert(@transactions[1].active?)
49
+
50
+ assert(@transactions[0].connections == [@connections[0]])
51
+ assert(@transactions[1].connections == [@connections[1]])
52
+
53
+ assert(@transactions[0].for_connection?(@connections[1]) == false)
54
+ assert(@transactions[1].for_connection?(@connections[0]) == false)
55
+ assert(@transactions[0].for_connection?(@connections[0]))
56
+ assert(@transactions[1].for_connection?(@connections[1]))
57
+
58
+ @transactions[0].commit
59
+ assert(@transactions[0].active? == false)
60
+ assert(@transactions[0].connections == [])
61
+ assert(@transactions[0].for_connection?(@connections[0]) == false)
62
+ assert(@transactions[0].for_connection?(@connections[1]) == false)
63
+
64
+ @transactions[1].rollback
65
+ assert(@transactions[1].active? == false)
66
+ assert(@transactions[1].connections == [])
67
+ assert(@transactions[1].for_connection?(@connections[0]) == false)
68
+ assert(@transactions[1].for_connection?(@connections[1]) == false)
69
+
70
+ @transactions[0] = Transaction.new([@connections[0], @connections[1]])
71
+ assert(@transactions[0].active? == true)
72
+ assert(@transactions[0].for_connection?(@connections[0]))
73
+ assert(@transactions[0].for_connection?(@connections[1]))
74
+ assert(@transactions[0].for_connection?(@connections[2]) == false)
75
+
76
+ @transactions[0].commit
77
+ assert(@transactions[0].active? == false)
78
+ assert(@transactions[0].connections == [])
79
+ assert(@transactions[0].for_connection?(@connections[0]) == false)
80
+ assert(@transactions[0].for_connection?(@connections[1]) == false)
81
+ assert(@transactions[0].for_connection?(@connections[2]) == false)
82
+
83
+ @transactions[0] = Transaction.new([@connections[0], @connections[2]])
84
+ assert(@transactions[0].active?)
85
+ @transactions[0].rollback
86
+ assert(@transactions[0].active? == false)
87
+ assert(@transactions[0].connections == [])
88
+ assert(@transactions[0].for_connection?(@connections[0]) == false)
89
+ assert(@transactions[0].for_connection?(@connections[1]) == false)
90
+ assert(@transactions[0].for_connection?(@connections[2]) == false)
91
+ end
92
+
93
+ def test02
94
+ sql = []
95
+ sql.push("UPDATE RDB$EXCEPTIONS SET RDB$MESSAGE = 'WoooHooo'"\
96
+ "WHERE RDB$EXCEPTION_NAME = 'Lalala'")
97
+ sql.push("SELECT RDB$FIELD_NAME FROM RDB$FIELDS")
98
+ @transactions.push(Transaction.new(@connections[0]))
99
+
100
+ assert(@transactions[0].execute(sql[0]) == 0)
101
+ r = @transactions[0].execute(sql[1])
102
+ assert(r != nil)
103
+ assert(r.class == ResultSet)
104
+ r.close
105
+
106
+ total = 0
107
+ @transactions[0].execute(sql[1]) do |row|
108
+ total += 1
109
+ end
110
+ assert(total == 88)
111
+ end
112
+ end