fireruby 0.4.1-i586-linux → 0.4.2-i586-linux

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 +0 -0
  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 +55 -55
  10. data/test/BackupRestoreTest.rb +99 -99
  11. data/test/BlobTest.rb +56 -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 +71 -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 +47 -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,55 +1,55 @@
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 AddRemoveUserTest < Test::Unit::TestCase
11
- CURDIR = "#{Dir.getwd}"
12
- DB_FILE = "#{CURDIR}#{File::SEPARATOR}add_remove_user_unit_test.fdb"
13
-
14
- def setup
15
- puts "#{self.class.name} started." if TEST_LOGGING
16
- # Remove existing database files.
17
- @database = Database.new(DB_FILE)
18
- if File.exist?(DB_FILE)
19
- @database.drop(DB_USER_NAME, DB_PASSWORD)
20
- end
21
- Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
22
- end
23
-
24
- def teardown
25
- # Remove existing database files.
26
- if File.exist?(DB_FILE)
27
- @database.drop(DB_USER_NAME, DB_PASSWORD)
28
- end
29
- puts "#{self.class.name} finished." if TEST_LOGGING
30
- end
31
-
32
- def test01
33
- sm = ServiceManager.new('localhost')
34
- sm.connect(DB_USER_NAME, DB_PASSWORD)
35
-
36
- au = AddUser.new('newuser', 'password', 'first', 'middle', 'last')
37
- au.execute(sm)
38
- sleep(3)
39
-
40
- cxn = @database.connect('newuser', 'password')
41
- cxn.close
42
-
43
- ru = RemoveUser.new('newuser')
44
- ru.execute(sm)
45
-
46
- sm.disconnect
47
-
48
- begin
49
- cxn = @database.connect('newuser', 'password')
50
- cxn.close
51
- assert(false, "Able to connect as supposedly removed user.")
52
- rescue FireRubyException
53
- end
54
- end
55
- 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 AddRemoveUserTest < Test::Unit::TestCase
11
+ CURDIR = "#{Dir.getwd}"
12
+ DB_FILE = "#{CURDIR}#{File::SEPARATOR}add_remove_user_unit_test.fdb"
13
+
14
+ def setup
15
+ puts "#{self.class.name} started." if TEST_LOGGING
16
+ # Remove existing database files.
17
+ @database = Database.new(DB_FILE)
18
+ if File.exist?(DB_FILE)
19
+ @database.drop(DB_USER_NAME, DB_PASSWORD)
20
+ end
21
+ Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
22
+ end
23
+
24
+ def teardown
25
+ # Remove existing database files.
26
+ if File.exist?(DB_FILE)
27
+ @database.drop(DB_USER_NAME, DB_PASSWORD)
28
+ end
29
+ puts "#{self.class.name} finished." if TEST_LOGGING
30
+ end
31
+
32
+ def test01
33
+ sm = ServiceManager.new('localhost')
34
+ sm.connect(DB_USER_NAME, DB_PASSWORD)
35
+
36
+ au = AddUser.new('newuser', 'password', 'first', 'middle', 'last')
37
+ au.execute(sm)
38
+ sleep(3)
39
+
40
+ cxn = @database.connect('newuser', 'password')
41
+ cxn.close
42
+
43
+ ru = RemoveUser.new('newuser')
44
+ ru.execute(sm)
45
+
46
+ sm.disconnect
47
+
48
+ begin
49
+ cxn = @database.connect('newuser', 'password')
50
+ cxn.close
51
+ assert(false, "Able to connect as supposedly removed user.")
52
+ rescue FireRubyException
53
+ end
54
+ end
55
+ end
@@ -1,99 +1,99 @@
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 BackupRestoreTest < Test::Unit::TestCase
11
- CURDIR = "#{Dir.getwd}"
12
- DB_FILE = "#{CURDIR}#{File::SEPARATOR}backup_restore_unit_test.fdb"
13
- BACKUP_FILE = "#{CURDIR}#{File::SEPARATOR}database.bak"
14
-
15
- def setup
16
- puts "#{self.class.name} started." if TEST_LOGGING
17
- # Remove existing database files.
18
- if File.exist?(DB_FILE)
19
- db = Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
20
- end
21
-
22
- if File.exist?(BACKUP_FILE)
23
- File.delete(BACKUP_FILE)
24
- end
25
-
26
- # Create and populate the database files.
27
- @database = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
28
- @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
29
- cxn.execute_immediate('create table test(id integer)')
30
- cxn.execute_immediate('insert into test values (1000)')
31
- cxn.execute_immediate('insert into test values (2000)')
32
- cxn.execute_immediate('insert into test values (NULL)')
33
- cxn.execute_immediate('insert into test values (3000)')
34
- cxn.execute_immediate('insert into test values (4000)')
35
- end
36
- end
37
-
38
- def teardown
39
- # Remove existing database files.
40
- if File.exist?(DB_FILE)
41
- db = Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
42
- end
43
-
44
- if File.exist?(BACKUP_FILE)
45
- File.delete(BACKUP_FILE)
46
- end
47
- puts "#{self.class.name} finished." if TEST_LOGGING
48
- end
49
-
50
- def test01
51
- sm = ServiceManager.new('localhost')
52
- sm.connect(DB_USER_NAME, DB_PASSWORD)
53
-
54
- b = Backup.new(DB_FILE, BACKUP_FILE)
55
- b.execute(sm)
56
-
57
- assert(File.exist?(BACKUP_FILE))
58
- @database.drop(DB_USER_NAME, DB_PASSWORD)
59
- assert(File.exists?(DB_FILE) == false)
60
-
61
- r = Restore.new(BACKUP_FILE, DB_FILE)
62
- r.execute(sm)
63
- sm.disconnect
64
-
65
- assert(File.exist?(DB_FILE))
66
- @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
67
- total = 0
68
- cxn.execute_immediate('select * from test') do |row|
69
- assert([1000, 2000, 3000, 4000, nil].include?(row[0]))
70
- total += 1
71
- end
72
- assert(total == 5)
73
- end
74
- end
75
-
76
- def test02
77
- sm = ServiceManager.new('localhost')
78
- sm.connect(DB_USER_NAME, DB_PASSWORD)
79
-
80
- b = Backup.new(DB_FILE, BACKUP_FILE)
81
- b.metadata_only = true
82
- b.execute(sm)
83
-
84
- assert(File.exist?(BACKUP_FILE))
85
- @database.drop(DB_USER_NAME, DB_PASSWORD)
86
- assert(File.exists?(DB_FILE) == false)
87
-
88
- r = Restore.new(BACKUP_FILE, DB_FILE)
89
- r.execute(sm)
90
- sm.disconnect
91
-
92
- assert(File.exist?(DB_FILE))
93
- @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
94
- cxn.execute_immediate('select count(*) from test') do |row|
95
- assert(row[0] == 0)
96
- end
97
- end
98
- end
99
- 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 BackupRestoreTest < Test::Unit::TestCase
11
+ CURDIR = "#{Dir.getwd}"
12
+ DB_FILE = "#{CURDIR}#{File::SEPARATOR}backup_restore_unit_test.fdb"
13
+ BACKUP_FILE = "#{CURDIR}#{File::SEPARATOR}database.bak"
14
+
15
+ def setup
16
+ puts "#{self.class.name} started." if TEST_LOGGING
17
+ # Remove existing database files.
18
+ if File.exist?(DB_FILE)
19
+ db = Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
20
+ end
21
+
22
+ if File.exist?(BACKUP_FILE)
23
+ File.delete(BACKUP_FILE)
24
+ end
25
+
26
+ # Create and populate the database files.
27
+ @database = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
28
+ @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
29
+ cxn.execute_immediate('create table test(id integer)')
30
+ cxn.execute_immediate('insert into test values (1000)')
31
+ cxn.execute_immediate('insert into test values (2000)')
32
+ cxn.execute_immediate('insert into test values (NULL)')
33
+ cxn.execute_immediate('insert into test values (3000)')
34
+ cxn.execute_immediate('insert into test values (4000)')
35
+ end
36
+ end
37
+
38
+ def teardown
39
+ # Remove existing database files.
40
+ if File.exist?(DB_FILE)
41
+ db = Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
42
+ end
43
+
44
+ if File.exist?(BACKUP_FILE)
45
+ File.delete(BACKUP_FILE)
46
+ end
47
+ puts "#{self.class.name} finished." if TEST_LOGGING
48
+ end
49
+
50
+ def test01
51
+ sm = ServiceManager.new('localhost')
52
+ sm.connect(DB_USER_NAME, DB_PASSWORD)
53
+
54
+ b = Backup.new(DB_FILE, BACKUP_FILE)
55
+ b.execute(sm)
56
+
57
+ assert(File.exist?(BACKUP_FILE))
58
+ @database.drop(DB_USER_NAME, DB_PASSWORD)
59
+ assert(File.exists?(DB_FILE) == false)
60
+
61
+ r = Restore.new(BACKUP_FILE, DB_FILE)
62
+ r.execute(sm)
63
+ sm.disconnect
64
+
65
+ assert(File.exist?(DB_FILE))
66
+ @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
67
+ total = 0
68
+ cxn.execute_immediate('select * from test') do |row|
69
+ assert([1000, 2000, 3000, 4000, nil].include?(row[0]))
70
+ total += 1
71
+ end
72
+ assert(total == 5)
73
+ end
74
+ end
75
+
76
+ def test02
77
+ sm = ServiceManager.new('localhost')
78
+ sm.connect(DB_USER_NAME, DB_PASSWORD)
79
+
80
+ b = Backup.new(DB_FILE, BACKUP_FILE)
81
+ b.metadata_only = true
82
+ b.execute(sm)
83
+
84
+ assert(File.exist?(BACKUP_FILE))
85
+ @database.drop(DB_USER_NAME, DB_PASSWORD)
86
+ assert(File.exists?(DB_FILE) == false)
87
+
88
+ r = Restore.new(BACKUP_FILE, DB_FILE)
89
+ r.execute(sm)
90
+ sm.disconnect
91
+
92
+ assert(File.exist?(DB_FILE))
93
+ @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
94
+ cxn.execute_immediate('select count(*) from test') do |row|
95
+ assert(row[0] == 0)
96
+ end
97
+ end
98
+ end
99
+ end
data/test/BlobTest.rb ADDED
@@ -0,0 +1,56 @@
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 BlobTest < Test::Unit::TestCase
11
+ CURDIR = "#{Dir.getwd}"
12
+ DB_FILE = "#{CURDIR}#{File::SEPARATOR}blob_unit_test.fdb"
13
+ TXT_FILE = "#{CURDIR}#{File::SEPARATOR}data.txt"
14
+ DATA = "aasdfjakhdsfljkashdfslfhaslhasyhfawyufalwuhlhsdlkfhasljlkshflalksjhasjhalsjhdf\nasdflkajshdfjkahsdfjajdfalsdfasdf\nasdfasdfasdkljfhajdfhkjasdfagdsflalkjfgagsdflasdf\nasdfasdfasdf"
15
+
16
+ def setup
17
+ puts "#{self.class.name} started." if TEST_LOGGING
18
+ # Remove existing database files.
19
+ @database = Database.new(DB_FILE)
20
+ if File.exist?(DB_FILE)
21
+ @database.drop(DB_USER_NAME, DB_PASSWORD)
22
+ end
23
+ Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
24
+ end
25
+
26
+ def teardown
27
+ # Remove existing database files.
28
+ if File.exist?(DB_FILE)
29
+ @database.drop(DB_USER_NAME, DB_PASSWORD)
30
+ end
31
+
32
+ puts "#{self.class.name} finished." if TEST_LOGGING
33
+ end
34
+
35
+ def test01
36
+ d = nil
37
+ @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
38
+ cxn.execute_immediate('create table blob_test (data blob sub_type 0)')
39
+ cxn.start_transaction do |tx|
40
+
41
+ s = Statement.new(cxn, tx, 'INSERT INTO BLOB_TEST VALUES(?)', 3)
42
+ s.execute_for([DATA])
43
+
44
+ # Perform a select of the value inserted.
45
+ r = cxn.execute('SELECT * FROM BLOB_TEST', tx)
46
+ d = r.fetch
47
+
48
+ # Clean up.
49
+ s.close
50
+ r.close
51
+ end
52
+ assert_equal(d[0].to_s, DATA)
53
+ cxn.execute_immediate('DROP TABLE BLOB_TEST')
54
+ end
55
+ end
56
+ end
@@ -1,63 +1,63 @@
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 CharacterSetTest < Test::Unit::TestCase
11
- CURDIR = "#{Dir.getwd}"
12
- DB_FILE = "#{CURDIR}#{File::SEPARATOR}cxnarset_unit_test.fdb"
13
- CHAR_SET = 'WIN1251'
14
-
15
- def setup
16
- puts "#{self.class.name} started." if TEST_LOGGING
17
- if File::exist?(DB_FILE)
18
- Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
19
- end
20
-
21
- @database = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD, 1024,
22
- CHAR_SET)
23
- end
24
-
25
- def teardown
26
- if File::exist?(DB_FILE)
27
- Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
28
- end
29
- puts "#{self.class.name} finished." if TEST_LOGGING
30
- end
31
-
32
- def test01
33
- db = Database.new(DB_FILE, CHAR_SET)
34
-
35
- assert(db.character_set = CHAR_SET)
36
-
37
- db.character_set = 'ASCII'
38
- assert(db.character_set == 'ASCII')
39
- end
40
-
41
- def test02
42
- text = "�?����"
43
- db = Database.new(DB_FILE, CHAR_SET)
44
-
45
- begin
46
- db.connect("SYSDBA", "masterkey") do |cxn|
47
- cxn.start_transaction do |tr|
48
- cxn.execute("CREATE TABLE SAMPLE_TABLE(SAMPLE_FIELD VARCHAR(100))",tr)
49
- end
50
- cxn.start_transaction do |tr|
51
- cxn.execute("INSERT INTO SAMPLE_TABLE VALUES ('#{win1251_str}')",tr)
52
- cxn.execute("SELECT * FROM SAMPLE_TABLE WHERE SAMPLE_FIELD = "\
53
- "'#{win1251_str}'",tr) do |row|
54
- # here we have an exception:
55
- some_var = row['SAMPLE_FIELD']
56
- end
57
- end
58
- end
59
- rescue => error
60
- assert("Character set unit test failure.", false)
61
- end
62
- end
63
- 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 CharacterSetTest < Test::Unit::TestCase
11
+ CURDIR = "#{Dir.getwd}"
12
+ DB_FILE = "#{CURDIR}#{File::SEPARATOR}cxnarset_unit_test.fdb"
13
+ CHAR_SET = 'WIN1251'
14
+
15
+ def setup
16
+ puts "#{self.class.name} started." if TEST_LOGGING
17
+ if File::exist?(DB_FILE)
18
+ Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
19
+ end
20
+
21
+ @database = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD, 1024,
22
+ CHAR_SET)
23
+ end
24
+
25
+ def teardown
26
+ if File::exist?(DB_FILE)
27
+ Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
28
+ end
29
+ puts "#{self.class.name} finished." if TEST_LOGGING
30
+ end
31
+
32
+ def test01
33
+ db = Database.new(DB_FILE, CHAR_SET)
34
+
35
+ assert(db.character_set = CHAR_SET)
36
+
37
+ db.character_set = 'ASCII'
38
+ assert(db.character_set == 'ASCII')
39
+ end
40
+
41
+ def test02
42
+ text = "�?����"
43
+ db = Database.new(DB_FILE, CHAR_SET)
44
+
45
+ begin
46
+ db.connect("SYSDBA", "masterkey") do |cxn|
47
+ cxn.start_transaction do |tr|
48
+ cxn.execute("CREATE TABLE SAMPLE_TABLE(SAMPLE_FIELD VARCHAR(100))",tr)
49
+ end
50
+ cxn.start_transaction do |tr|
51
+ cxn.execute("INSERT INTO SAMPLE_TABLE VALUES ('#{win1251_str}')",tr)
52
+ cxn.execute("SELECT * FROM SAMPLE_TABLE WHERE SAMPLE_FIELD = "\
53
+ "'#{win1251_str}'",tr) do |row|
54
+ # here we have an exception:
55
+ some_var = row['SAMPLE_FIELD']
56
+ end
57
+ end
58
+ end
59
+ rescue => error
60
+ assert("Character set unit test failure.", false)
61
+ end
62
+ end
63
+ end