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
data/doc/license.txt CHANGED
File without changes
@@ -1,65 +1,65 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require_gem 'fireruby'
5
-
6
- include FireRuby
7
-
8
- # Database details constants.
9
- DB_FILE = "localhost:#{File.expand_path('.')}#{File::SEPARATOR}example.fdb"
10
- DB_USER_NAME = "sysdba"
11
- DB_PASSWORD = "masterkey"
12
-
13
- # SQL constants.
14
- CREATE_TABLE_SQL = 'CREATE TABLE TESTTABLE (TESTID INTEGER NOT NULL PRIMARY '\
15
- 'KEY, TESTTEXT VARCHAR(100), TESTFLOAT NUMERIC(6,2), '\
16
- 'CREATED TIMESTAMP)'
17
- DROP_TABLE_SQL = 'DROP TABLE TESTTABLE'
18
- INSERT_SQL = 'INSERT INTO TESTTABLE VALUES(?, ?, ?, ?)'
19
- SELECT_SQL = 'SELECT * FROM TESTTABLE'
20
-
21
- begin
22
- # Check if the database file exists.
23
- db = nil
24
- if File.exist?(DB_FILE) == false
25
- # Create the database file.
26
- db = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD, 1024, 'ASCII')
27
- else
28
- # Create the databse object.
29
- db = Database.new(DB_FILE)
30
- end
31
-
32
- # Obtain a connection to the database.
33
- db.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
34
- # Create the database table.
35
- cxn.execute_immediate(CREATE_TABLE_SQL)
36
-
37
- # Insert 50 rows into the database.
38
- decimal = 1.0
39
- cxn.start_transaction do |tx|
40
- s = Statement.new(cxn, tx, INSERT_SQL, 3)
41
- 1.upto(20) do |number|
42
- s.execute_for([number, "Number is #{number}.", decimal, Time.new])
43
- decimal = decimal + 0.24
44
- end
45
- s.close
46
- end
47
-
48
- # Select back the rows inserted and display them
49
- rows = cxn.execute_immediate(SELECT_SQL)
50
- rows.each do |row|
51
- puts "-----"
52
- puts "Test Id: #{row['TESTID']}"
53
- puts "Test Text: '#{row['TESTTEXT']}'"
54
- puts "Test Float: #{row['TESTFLOAT']}"
55
- puts "Test Created: #{row['CREATED']}"
56
- puts "-----"
57
- end
58
- rows.close
59
-
60
- # Drop the table.
61
- cxn.execute_immediate(DROP_TABLE_SQL)
62
- end
63
- rescue Excepton => error
64
- puts error.message
65
- end
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require_gem 'fireruby'
5
+
6
+ include FireRuby
7
+
8
+ # Database details constants.
9
+ DB_FILE = "localhost:#{File.expand_path('.')}#{File::SEPARATOR}example.fdb"
10
+ DB_USER_NAME = "sysdba"
11
+ DB_PASSWORD = "masterkey"
12
+
13
+ # SQL constants.
14
+ CREATE_TABLE_SQL = 'CREATE TABLE TESTTABLE (TESTID INTEGER NOT NULL PRIMARY '\
15
+ 'KEY, TESTTEXT VARCHAR(100), TESTFLOAT NUMERIC(6,2), '\
16
+ 'CREATED TIMESTAMP)'
17
+ DROP_TABLE_SQL = 'DROP TABLE TESTTABLE'
18
+ INSERT_SQL = 'INSERT INTO TESTTABLE VALUES(?, ?, ?, ?)'
19
+ SELECT_SQL = 'SELECT * FROM TESTTABLE'
20
+
21
+ begin
22
+ # Check if the database file exists.
23
+ db = nil
24
+ if File.exist?(DB_FILE) == false
25
+ # Create the database file.
26
+ db = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD, 1024, 'ASCII')
27
+ else
28
+ # Create the databse object.
29
+ db = Database.new(DB_FILE)
30
+ end
31
+
32
+ # Obtain a connection to the database.
33
+ db.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
34
+ # Create the database table.
35
+ cxn.execute_immediate(CREATE_TABLE_SQL)
36
+
37
+ # Insert 50 rows into the database.
38
+ decimal = 1.0
39
+ cxn.start_transaction do |tx|
40
+ s = Statement.new(cxn, tx, INSERT_SQL, 3)
41
+ 1.upto(20) do |number|
42
+ s.execute_for([number, "Number is #{number}.", decimal, Time.new])
43
+ decimal = decimal + 0.24
44
+ end
45
+ s.close
46
+ end
47
+
48
+ # Select back the rows inserted and display them
49
+ rows = cxn.execute_immediate(SELECT_SQL)
50
+ rows.each do |row|
51
+ puts "-----"
52
+ puts "Test Id: #{row['TESTID']}"
53
+ puts "Test Text: '#{row['TESTTEXT']}'"
54
+ puts "Test Float: #{row['TESTFLOAT']}"
55
+ puts "Test Created: #{row['CREATED']}"
56
+ puts "-----"
57
+ end
58
+ rows.close
59
+
60
+ # Drop the table.
61
+ cxn.execute_immediate(DROP_TABLE_SQL)
62
+ end
63
+ rescue Excepton => error
64
+ puts error.message
65
+ end
data/lib/SQLType.rb CHANGED
@@ -1,228 +1,224 @@
1
- #-------------------------------------------------------------------------------
2
- # SQLType.rb
3
- #-------------------------------------------------------------------------------
4
- # Copyright � Peter Wood, 2005
5
- #
6
- # The contents of this file are subject to the Mozilla Public License Version
7
- # 1.1 (the "License"); you may not use this file except in compliance with the
8
- # License. You may obtain a copy of the License at
9
- #
10
- # http://www.mozilla.org/MPL/
11
- #
12
- # Software distributed under the License is distributed on an "AS IS" basis,
13
- # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14
- # the specificlanguage governing rights and limitations under the License.
15
- #
16
- # The Original Code is the FireRuby extension for the Ruby language.
17
- #
18
- # The Initial Developer of the Original Code is Peter Wood. All Rights
19
- # Reserved.
20
-
21
- module FireRuby
22
- # This class is used to represent SQL table column tables.
23
- class SQLType
24
- # A definition for a base SQL type.
25
- BIGINT = :BIGINT
26
-
27
- # A definition for a base SQL type.
28
- BLOB = :BLOB
29
-
30
- # A definition for a base SQL type.
31
- CHAR = :CHAR
32
-
33
- # A definition for a base SQL type.
34
- DATE = :DATE
35
-
36
- # A definition for a base SQL type.
37
- DECIMAL = :DECIMAL
38
-
39
- # A definition for a base SQL type.
40
- DOUBLE = :DOUBLE
41
-
42
- # A definition for a base SQL type.
43
- FLOAT = :FLOAT
44
-
45
- # A definition for a base SQL type.
46
- INTEGER = :INTEGER
47
-
48
- # A definition for a base SQL type.
49
- NUMERIC = :NUMERIC
50
-
51
- # A definition for a base SQL type.
52
- SMALLINT = :SMALLINT
53
-
54
- # A definition for a base SQL type.
55
- TIME = :TIME
56
-
57
- # A definition for a base SQL type.
58
- TIMESTAMP = :TIMESTAMP
59
-
60
- # A definition for a base SQL type.
61
- VARCHAR = :VARCHAR
62
-
63
- # Attribute accessor.
64
- attr_reader :type, :length, :precision, :scale, :subtype
65
-
66
-
67
- # This is the constructor for the SQLType class.
68
- #
69
- # ==== Parameters
70
- # type:: The base type for the SQLType object. Must be one of the
71
- # base types defined within the class.
72
- # length:: The length setting for the type. Defaults to nil.
73
- # precision:: The precision setting for the type. Defaults to nil.
74
- # scale:: The scale setting for the type. Defaults to nil.
75
- # subtype:: The SQL sub-type setting. Defaults to nil.
76
- def initialize(type, length=nil, precision=nil, scale=nil, subtype=nil)
77
- @type = type
78
- @length = length
79
- @precision = precision
80
- @scale = scale
81
- @subtype = subtype
82
- end
83
-
84
-
85
- # This class method fetches the type details for a named table. The
86
- # method returns a hash that links column names to SQLType objects.
87
- #
88
- # ==== Parameters
89
- # table:: A string containing the name of the table.
90
- # connection:: A reference to the connection to be used to determine
91
- # the type information.
92
- #
93
- # ==== Exception
94
- # FireRubyException:: Generated if an invalid table name is specified
95
- # or an SQL error occurs.
96
- def SQLType.for_table(table, connection)
97
- # Check for naughty table names.
98
- if /\s+/ =~ table
99
- raise FireRubyException.new("'#{table}' is not a valid table name.")
100
- end
101
-
102
- types = {}
103
- begin
104
- sql = "SELECT RF.RDB$FIELD_NAME, F.RDB$FIELD_TYPE, "\
105
- "F.RDB$FIELD_LENGTH, F.RDB$FIELD_PRECISION, "\
106
- "F.RDB$FIELD_SCALE * -1, F.RDB$FIELD_SUB_TYPE "\
107
- "FROM RDB$RELATION_FIELDS RF, RDB$FIELDS F "\
108
- "WHERE RF.RDB$RELATION_NAME = UPPER('#{table}') "\
109
- "AND RF.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME"
110
-
111
- connection.start_transaction do |tx|
112
- tx.execute(sql) do |row|
113
- sql_type = SQLType.to_base_type(row[1], row[5])
114
- type = nil
115
- case sql_type
116
- when BLOB
117
- type = SQLType.new(sql_type, nil, nil, nil, row[5])
118
-
119
- when CHAR, VARCHAR
120
- type = SQLType.new(sql_type, row[2])
121
-
122
- when DECIMAL, NUMERIC
123
- type = SQLType.new(sql_type, nil, row[3], row[4])
124
-
125
- else
126
- type = SQLType.new(sql_type)
127
- end
128
- types[row[0].strip] = type
129
- end
130
-
131
- end
132
- end
133
- types
134
- end
135
-
136
-
137
- # This method overloads the equivalence test operator for the SQLType
138
- # class.
139
- #
140
- # ==== Parameters
141
- # object:: A reference to the object to be compared with.
142
- def ==(object)
143
- result = false
144
- if object.instance_of?(SQLType)
145
- result = (@type == object.type &&
146
- @length == object.length &&
147
- @precision == object.precision &&
148
- @scale == object.scale &&
149
- @subtype == object.subtype)
150
- end
151
- result
152
- end
153
-
154
-
155
- # This method generates a textual description for a SQLType object.
156
- def to_s
157
- if @type == SQLType::DECIMAL or @type == SQLType::NUMERIC
158
- "#{@type.id2name}(#{@precision},#{@scale})"
159
- elsif @type == SQLType::BLOB
160
- "#{@type.id2name} SUB TYPE #{@subtype}"
161
- elsif @type == SQLType::CHAR or @type == SQLType::VARCHAR
162
- "#{@type.id2name}(#{@length})"
163
- else
164
- @type.id2name
165
- end
166
- end
167
-
168
-
169
- # This class method converts a Firebird internal type to a SQLType base
170
- # type.
171
- #
172
- # ==== Parameters
173
- # type:: A reference to the Firebird field type value.
174
- # subtype:: A reference to the Firebird field subtype value.
175
- def SQLType.to_base_type(type, subtype)
176
- case type
177
- when 16 # BIGINT, DECIMAL, NUMERIC
178
- if subtype
179
- subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
180
- else
181
- SQLType::BIGINT
182
- end
183
-
184
- when 261 # BLOB
185
- SQLType::BLOB
186
-
187
- when 14 # CHAR
188
- SQLType::CHAR
189
-
190
- when 12 # DATE
191
- SQLType::DATE
192
-
193
- when 27 # DOUBLE, DECIMAL, NUMERIC
194
- if subtype
195
- subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
196
- else
197
- SQLType::DOUBLE
198
- end
199
-
200
- when 10 # FLOAT
201
- SQLType::FLOAT
202
-
203
- when 8 # INTEGER, DECIMAL, NUMERIC
204
- if subtype
205
- subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
206
- else
207
- SQLType::INTEGER
208
- end
209
-
210
- when 7 # SMALLINT, DECIMAL, NUMERIC
211
- if subtype
212
- subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
213
- else
214
- SQLType::SMALLINT
215
- end
216
-
217
- when 13 # TIME
218
- SQLType::TIME
219
-
220
- when 35 # TIMESTAMP
221
- SQLType::TIMESTAMP
222
-
223
- when 37 # VARCHAR
224
- SQLType::VARCHAR
225
- end
226
- end
227
- end # End of the SQLType class.
1
+ #-------------------------------------------------------------------------------
2
+ # SQLType.rb
3
+ #-------------------------------------------------------------------------------
4
+ # Copyright � Peter Wood, 2005
5
+ #
6
+ # The contents of this file are subject to the Mozilla Public License Version
7
+ # 1.1 (the "License"); you may not use this file except in compliance with the
8
+ # License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.mozilla.org/MPL/
11
+ #
12
+ # Software distributed under the License is distributed on an "AS IS" basis,
13
+ # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14
+ # the specificlanguage governing rights and limitations under the License.
15
+ #
16
+ # The Original Code is the FireRuby extension for the Ruby language.
17
+ #
18
+ # The Initial Developer of the Original Code is Peter Wood. All Rights
19
+ # Reserved.
20
+
21
+ module FireRuby
22
+ # This class is used to represent SQL table column tables.
23
+ class SQLType
24
+ # A definition for a base SQL type.
25
+ BIGINT = :BIGINT
26
+
27
+ # A definition for a base SQL type.
28
+ BLOB = :BLOB
29
+
30
+ # A definition for a base SQL type.
31
+ CHAR = :CHAR
32
+
33
+ # A definition for a base SQL type.
34
+ DATE = :DATE
35
+
36
+ # A definition for a base SQL type.
37
+ DECIMAL = :DECIMAL
38
+
39
+ # A definition for a base SQL type.
40
+ DOUBLE = :DOUBLE
41
+
42
+ # A definition for a base SQL type.
43
+ FLOAT = :FLOAT
44
+
45
+ # A definition for a base SQL type.
46
+ INTEGER = :INTEGER
47
+
48
+ # A definition for a base SQL type.
49
+ NUMERIC = :NUMERIC
50
+
51
+ # A definition for a base SQL type.
52
+ SMALLINT = :SMALLINT
53
+
54
+ # A definition for a base SQL type.
55
+ TIME = :TIME
56
+
57
+ # A definition for a base SQL type.
58
+ TIMESTAMP = :TIMESTAMP
59
+
60
+ # A definition for a base SQL type.
61
+ VARCHAR = :VARCHAR
62
+
63
+ # Attribute accessor.
64
+ attr_reader :type, :length, :precision, :scale, :subtype
65
+
66
+
67
+ # This is the constructor for the SQLType class.
68
+ #
69
+ # ==== Parameters
70
+ # type:: The base type for the SQLType object. Must be one of the
71
+ # base types defined within the class.
72
+ # length:: The length setting for the type. Defaults to nil.
73
+ # precision:: The precision setting for the type. Defaults to nil.
74
+ # scale:: The scale setting for the type. Defaults to nil.
75
+ # subtype:: The SQL sub-type setting. Defaults to nil.
76
+ def initialize(type, length=nil, precision=nil, scale=nil, subtype=nil)
77
+ @type = type
78
+ @length = length
79
+ @precision = precision
80
+ @scale = scale
81
+ @subtype = subtype
82
+ end
83
+
84
+
85
+ # This class method fetches the type details for a named table. The
86
+ # method returns a hash that links column names to SQLType objects.
87
+ #
88
+ # ==== Parameters
89
+ # table:: A string containing the name of the table.
90
+ # connection:: A reference to the connection to be used to determine
91
+ # the type information.
92
+ #
93
+ # ==== Exception
94
+ # FireRubyException:: Generated if an invalid table name is specified
95
+ # or an SQL error occurs.
96
+ def SQLType.for_table(table, connection)
97
+ # Check for naughty table names.
98
+ if /\s+/ =~ table
99
+ raise FireRubyException.new("'#{table}' is not a valid table name.")
100
+ end
101
+
102
+ types = {}
103
+ begin
104
+ sql = "SELECT RF.RDB$FIELD_NAME, F.RDB$FIELD_TYPE, "\
105
+ "F.RDB$FIELD_LENGTH, F.RDB$FIELD_PRECISION, "\
106
+ "F.RDB$FIELD_SCALE * -1, F.RDB$FIELD_SUB_TYPE "\
107
+ "FROM RDB$RELATION_FIELDS RF, RDB$FIELDS F "\
108
+ "WHERE RF.RDB$RELATION_NAME = UPPER('#{table}') "\
109
+ "AND RF.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME"
110
+
111
+ connection.start_transaction do |tx|
112
+ tx.execute(sql) do |row|
113
+ sql_type = SQLType.to_base_type(row[1], row[5])
114
+ type = nil
115
+ case sql_type
116
+ when BLOB
117
+ type = SQLType.new(sql_type, nil, nil, nil, row[5])
118
+
119
+ when CHAR, VARCHAR
120
+ type = SQLType.new(sql_type, row[2])
121
+
122
+ when DECIMAL, NUMERIC
123
+ type = SQLType.new(sql_type, nil, row[3], row[4])
124
+
125
+ else
126
+ type = SQLType.new(sql_type)
127
+ end
128
+ types[row[0].strip] = type
129
+ end
130
+
131
+ end
132
+ end
133
+ types
134
+ end
135
+
136
+
137
+ # This method overloads the equivalence test operator for the SQLType
138
+ # class.
139
+ #
140
+ # ==== Parameters
141
+ # object:: A reference to the object to be compared with.
142
+ def ==(object)
143
+ result = false
144
+ if object.instance_of?(SQLType)
145
+ result = (@type == object.type &&
146
+ @length == object.length &&
147
+ @precision == object.precision &&
148
+ @scale == object.scale &&
149
+ @subtype == object.subtype)
150
+ end
151
+ result
152
+ end
153
+
154
+
155
+ # This method generates a textual description for a SQLType object.
156
+ def to_s
157
+ if @type == SQLType::DECIMAL or @type == SQLType::NUMERIC
158
+ "#{@type.id2name}(#{@precision},#{@scale})"
159
+ elsif @type == SQLType::BLOB
160
+ "#{@type.id2name} SUB TYPE #{@subtype}"
161
+ elsif @type == SQLType::CHAR or @type == SQLType::VARCHAR
162
+ "#{@type.id2name}(#{@length})"
163
+ else
164
+ @type.id2name
165
+ end
166
+ end
167
+
168
+
169
+ # This class method converts a Firebird internal type to a SQLType base
170
+ # type.
171
+ #
172
+ # ==== Parameters
173
+ # type:: A reference to the Firebird field type value.
174
+ # subtype:: A reference to the Firebird field subtype value.
175
+ def SQLType.to_base_type(type, subtype)
176
+ case type
177
+ when 16 # BIGINT, DECIMAL, NUMERIC
178
+ case subtype
179
+ when 1 then SQLType::NUMERIC
180
+ when 2 then SQLType::DECIMAL
181
+ else SQLType::BIGINT
182
+ end
183
+
184
+ when 261 # BLOB
185
+ SQLType::BLOB
186
+
187
+ when 14 # CHAR
188
+ SQLType::CHAR
189
+
190
+ when 12 # DATE
191
+ SQLType::DATE
192
+
193
+ when 27 # DOUBLE
194
+ SQLType::DOUBLE
195
+
196
+ when 10 # FLOAT
197
+ SQLType::FLOAT
198
+
199
+ when 8 # INTEGER, DECIMAL, NUMERIC
200
+ case subtype
201
+ when 1 then SQLType::NUMERIC
202
+ when 2 then SQLType::DECIMAL
203
+ else SQLType::INTEGER
204
+ end
205
+
206
+ when 7 # SMALLINT, DECIMAL, NUMERIC
207
+ case subtype
208
+ when 1 then SQLType::NUMERIC
209
+ when 2 then SQLType::DECIMAL
210
+ else SQLType::SMALLINT
211
+ end
212
+
213
+ when 13 # TIME
214
+ SQLType::TIME
215
+
216
+ when 35 # TIMESTAMP
217
+ SQLType::TIMESTAMP
218
+
219
+ when 37 # VARCHAR
220
+ SQLType::VARCHAR
221
+ end
222
+ end
223
+ end # End of the SQLType class.
228
224
  end # End of the FireRuby module.