activerecord-jdbc-adapter 1.3.17 → 1.3.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +24 -5
  3. data/History.md +54 -0
  4. data/lib/arel/visitors/compat.rb +30 -2
  5. data/lib/arel/visitors/db2.rb +118 -29
  6. data/lib/arel/visitors/derby.rb +84 -29
  7. data/lib/arel/visitors/firebird.rb +66 -9
  8. data/lib/arel/visitors/h2.rb +16 -0
  9. data/lib/arel/visitors/hsqldb.rb +6 -3
  10. data/lib/arel/visitors/postgresql_jdbc.rb +6 -0
  11. data/lib/arel/visitors/sql_server.rb +121 -40
  12. data/lib/arel/visitors/sql_server/ng42.rb +293 -0
  13. data/lib/arjdbc.rb +1 -7
  14. data/lib/arjdbc/db2.rb +1 -0
  15. data/lib/arjdbc/db2/adapter.rb +118 -18
  16. data/lib/arjdbc/derby/adapter.rb +29 -8
  17. data/lib/arjdbc/firebird.rb +1 -0
  18. data/lib/arjdbc/firebird/adapter.rb +126 -11
  19. data/lib/arjdbc/hsqldb/adapter.rb +3 -0
  20. data/lib/arjdbc/informix.rb +1 -0
  21. data/lib/arjdbc/jdbc.rb +17 -0
  22. data/lib/arjdbc/jdbc/adapter.rb +28 -3
  23. data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
  24. data/lib/arjdbc/jdbc/column.rb +7 -3
  25. data/lib/arjdbc/jdbc/type_cast.rb +2 -0
  26. data/lib/arjdbc/jdbc/type_converter.rb +28 -15
  27. data/lib/arjdbc/mimer.rb +1 -0
  28. data/lib/arjdbc/mssql.rb +2 -1
  29. data/lib/arjdbc/mssql/adapter.rb +105 -30
  30. data/lib/arjdbc/mssql/column.rb +30 -7
  31. data/lib/arjdbc/mssql/limit_helpers.rb +22 -9
  32. data/lib/arjdbc/mssql/types.rb +343 -0
  33. data/lib/arjdbc/mssql/utils.rb +25 -2
  34. data/lib/arjdbc/mysql/adapter.rb +22 -21
  35. data/lib/arjdbc/oracle.rb +1 -0
  36. data/lib/arjdbc/oracle/adapter.rb +291 -19
  37. data/lib/arjdbc/oracle/column.rb +9 -5
  38. data/lib/arjdbc/oracle/connection_methods.rb +4 -1
  39. data/lib/arjdbc/postgresql/_bc_time_cast_patch.rb +21 -0
  40. data/lib/arjdbc/postgresql/adapter.rb +7 -1
  41. data/lib/arjdbc/postgresql/oid/bytea.rb +3 -0
  42. data/lib/arjdbc/postgresql/oid_types.rb +2 -1
  43. data/lib/arjdbc/tasks/database_tasks.rb +3 -0
  44. data/lib/arjdbc/util/quoted_cache.rb +2 -2
  45. data/lib/arjdbc/util/serialized_attributes.rb +11 -0
  46. data/lib/arjdbc/version.rb +1 -1
  47. data/rakelib/02-test.rake +1 -1
  48. data/rakelib/db.rake +3 -1
  49. data/src/java/arjdbc/firebird/FirebirdRubyJdbcConnection.java +190 -0
  50. data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +259 -61
  51. data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +13 -2
  52. data/src/java/arjdbc/oracle/OracleRubyJdbcConnection.java +192 -15
  53. data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +10 -2
  54. metadata +9 -4
@@ -16,10 +16,4 @@ else
16
16
  warn "activerecord-jdbc-adapter is for use with JRuby only"
17
17
  end
18
18
 
19
- require 'arjdbc/version'
20
-
21
- # TODO: remove this "HINT" once AR 4.2 is working ~ fairly reliable :
22
- if ActiveRecord::VERSION::STRING[0, 3] == '4.2' && ENV['AR_JDBC_42'] != 'true'
23
- ArJdbc.warn "NOTE: ActiveRecord 4.2 is not (yet) fully supported by AR-JDBC," <<
24
- " please help us finish 4.2 support - check http://bit.ly/jruby-42 for starters"
25
- end
19
+ require 'arjdbc/version'
@@ -1,3 +1,4 @@
1
1
  require 'arjdbc'
2
2
  require 'arjdbc/db2/adapter'
3
3
  require 'arjdbc/db2/connection_methods'
4
+ ArJdbc.warn_unsupported_adapter 'db2', [4, 2] # warns on AR >= 4.2
@@ -1,3 +1,27 @@
1
+ # NOTE: file contains code adapted from **ruby-ibmdb** adapter, license follows
2
+ =begin
3
+ Copyright (c) 2006 - 2015 IBM Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ =end
24
+
1
25
  ArJdbc.load_java_part :DB2
2
26
 
3
27
  require 'arjdbc/db2/column'
@@ -111,6 +135,78 @@ module ArJdbc
111
135
  #:graphic => { :name => "graphic", :limit => 1 }, # :limit => 127
112
136
  }
113
137
 
138
+ # @override
139
+ def initialize_type_map(m)
140
+ register_class_with_limit m, %r(boolean)i, ActiveRecord::Type::Boolean
141
+ register_class_with_limit m, %r(char)i, ActiveRecord::Type::String
142
+ register_class_with_limit m, %r(binary)i, ActiveRecord::Type::Binary
143
+ register_class_with_limit m, %r(text)i, ActiveRecord::Type::Text
144
+ register_class_with_limit m, %r(date)i, ActiveRecord::Type::Date
145
+ register_class_with_limit m, %r(time)i, ActiveRecord::Type::Time
146
+ register_class_with_limit m, %r(datetime)i, ActiveRecord::Type::DateTime
147
+ register_class_with_limit m, %r(float)i, ActiveRecord::Type::Float
148
+ register_class_with_limit m, %r(int)i, ActiveRecord::Type::Integer
149
+
150
+ m.alias_type %r(blob)i, 'binary'
151
+ m.alias_type %r(clob)i, 'text'
152
+ m.alias_type %r(timestamp)i, 'datetime'
153
+ m.alias_type %r(numeric)i, 'decimal'
154
+ m.alias_type %r(number)i, 'decimal'
155
+ m.alias_type %r(double)i, 'float'
156
+ m.alias_type %r(real)i, 'float'
157
+
158
+ m.register_type(%r(decimal)i) do |sql_type|
159
+ scale = extract_scale(sql_type)
160
+ precision = extract_precision(sql_type)
161
+ limit = extract_limit(sql_type)
162
+ if scale == 0
163
+ ActiveRecord::Type::BigInteger.new(:precision => precision, :limit => limit)
164
+ else
165
+ ActiveRecord::Type::Decimal.new(:precision => precision, :scale => scale)
166
+ end
167
+ end
168
+
169
+ m.alias_type %r(for bit data)i, 'binary'
170
+ m.alias_type %r(smallint)i, 'boolean'
171
+ m.alias_type %r(serial)i, 'int'
172
+ m.alias_type %r(decfloat)i, 'decimal'
173
+ #m.alias_type %r(real)i, 'decimal'
174
+ m.alias_type %r(graphic)i, 'binary'
175
+ m.alias_type %r(rowid)i, 'int'
176
+
177
+ m.register_type(%r(smallint)i) do
178
+ if DB2.emulate_booleans?
179
+ ActiveRecord::Type::Boolean.new
180
+ else
181
+ ActiveRecord::Type::Integer.new(:limit => 1)
182
+ end
183
+ end
184
+
185
+ m.register_type %r(xml)i, XmlType.new
186
+ end if AR42
187
+
188
+ # @private
189
+ class XmlType < ActiveRecord::Type::String
190
+ def type; :xml end
191
+
192
+ def type_cast_for_database(value)
193
+ return unless value
194
+ Data.new(super)
195
+ end
196
+
197
+ class Data
198
+ def initialize(value)
199
+ @value = value
200
+ end
201
+ def to_s; @value end
202
+ end
203
+ end if AR42
204
+
205
+ # @override
206
+ def reset_column_information
207
+ initialize_type_map(type_map)
208
+ end if AR42
209
+
114
210
  # @override
115
211
  def native_database_types
116
212
  # NOTE: currently merging with what JDBC gives us since there's a lot
@@ -389,31 +485,35 @@ module ArJdbc
389
485
  # @note Only used with (non-AREL) ActiveRecord **2.3**.
390
486
  # @see Arel::Visitors::DB2
391
487
  def add_limit_offset!(sql, options)
392
- replace_limit_offset!(sql, options[:limit], options[:offset])
488
+ limit = options[:limit]
489
+ replace_limit_offset!(sql, limit, options[:offset]) if limit
393
490
  end if ::ActiveRecord::VERSION::MAJOR < 3
394
491
 
395
492
  # @private shared with {Arel::Visitors::DB2}
396
- def replace_limit_offset!(sql, limit, offset)
397
- return sql unless limit
398
-
493
+ def replace_limit_offset!(sql, limit, offset, orders = nil)
399
494
  limit = limit.to_i
400
- if offset
401
- replace_limit_offset_with_ordering!(sql, limit, offset)
495
+
496
+ if offset # && limit
497
+ over_order_by = nil # NOTE: orders matching got reverted as it was not complete and there were no case covering it ...
498
+
499
+ start_sql = "SELECT B.* FROM (SELECT A.*, row_number() OVER (#{over_order_by}) AS internal$rownum FROM (SELECT"
500
+ end_sql = ") A ) B WHERE B.internal$rownum > #{offset} AND B.internal$rownum <= #{limit + offset.to_i}"
501
+
502
+ if sql.is_a?(String)
503
+ sql.sub!(/SELECT/i, start_sql)
504
+ sql << end_sql
505
+ else # AR 4.2 sql.class ... Arel::Collectors::Bind
506
+ sql.parts[0] = start_sql # sql.sub! /SELECT/i
507
+ sql.parts[ sql.parts.length ] = end_sql
508
+ end
402
509
  else
403
- if limit == 1
404
- sql << " FETCH FIRST ROW ONLY"
405
- else
406
- sql << " FETCH FIRST #{limit} ROWS ONLY"
510
+ limit_sql = limit == 1 ? " FETCH FIRST ROW ONLY" : " FETCH FIRST #{limit} ROWS ONLY"
511
+ if sql.is_a?(String)
512
+ sql << limit_sql
513
+ else # AR 4.2 sql.class ... Arel::Collectors::Bind
514
+ sql.parts[ sql.parts.length ] = limit_sql
407
515
  end
408
- sql
409
516
  end
410
- end
411
-
412
- # @private used from {Arel::Visitors::DB2}
413
- def replace_limit_offset_with_ordering!(sql, limit, offset, orders = nil)
414
- over_order_by = nil # NOTE: orders matching got reverted as it was not complete and there were no case covering it ...
415
- sql.sub!(/SELECT/i, "SELECT B.* FROM (SELECT A.*, row_number() OVER (#{over_order_by}) AS internal$rownum FROM (SELECT")
416
- sql << ") A ) B WHERE B.internal$rownum > #{offset} AND B.internal$rownum <= #{limit + offset}"
417
517
  sql
418
518
  end
419
519
 
@@ -138,16 +138,16 @@ module ArJdbc
138
138
  :primary_key => "int GENERATED BY DEFAULT AS identity NOT NULL PRIMARY KEY",
139
139
  :string => { :name => "varchar", :limit => 255 }, # 32672
140
140
  :text => { :name => "clob" }, # 2,147,483,647
141
- :char => { :name => "char", :limit => 254 }, # JDBC limit: 254
141
+ :char => { :name => "char", :limit => 254 }, # JDBC :limit => 254
142
142
  :binary => { :name => "blob" }, # 2,147,483,647
143
143
  :float => { :name => "float", :limit => 8 }, # DOUBLE PRECISION
144
- :real => { :name => "real", :limit => 4 }, # JDBC limit: 23
145
- :double => { :name => "double", :limit => 8 }, # JDBC limit: 52
146
- :decimal => { :name => "decimal", :precision => 5, :scale => 0 }, # JDBC limit: 31
147
- :numeric => { :name => "decimal", :precision => 5, :scale => 0 }, # JDBC limit: 31
148
- :integer => { :name => "integer", :limit => 4 }, # JDBC limit: 10
149
- :smallint => { :name => "smallint", :limit => 2 }, # JDBC limit: 5
150
- :bigint => { :name => "bigint", :limit => 8 }, # JDBC limit: 19
144
+ :real => { :name => "real", :limit => 4 }, # JDBC :limit => 23
145
+ :double => { :name => "double", :limit => 8 }, # JDBC :limit => 52
146
+ :decimal => { :name => "decimal", :precision => 5, :scale => 0 }, # JDBC :limit => 31
147
+ :numeric => { :name => "decimal", :precision => 5, :scale => 0 }, # JDBC :limit => 31
148
+ :integer => { :name => "integer", :limit => 4 }, # JDBC :limit => 10
149
+ :smallint => { :name => "smallint", :limit => 2 }, # JDBC :limit => 5
150
+ :bigint => { :name => "bigint", :limit => 8 }, # JDBC :limit => 19
151
151
  :date => { :name => "date" },
152
152
  :time => { :name => "time" },
153
153
  :datetime => { :name => "timestamp" },
@@ -157,6 +157,23 @@ module ArJdbc
157
157
  :object => { :name => "object" },
158
158
  }
159
159
 
160
+ # @private
161
+ def initialize_type_map(m)
162
+ super
163
+ m.register_type(%r(smallint)i) do |sql_type|
164
+ if Derby.emulate_booleans?
165
+ ActiveRecord::Type::Boolean.new
166
+ else
167
+ ActiveRecord::Type::Integer.new(:limit => 1)
168
+ end
169
+ end
170
+ m.alias_type %r(real)i, 'float'
171
+ end if AR42
172
+
173
+ def reset_column_information
174
+ initialize_type_map(type_map)
175
+ end if AR42
176
+
160
177
  # @override
161
178
  def native_database_types
162
179
  NATIVE_DATABASE_TYPES
@@ -171,6 +188,7 @@ module ArJdbc
171
188
 
172
189
  # @override
173
190
  def quote(value, column = nil)
191
+ return super if column && ArJdbc::AR42 && column.cast_type.is_a?(ActiveRecord::Type::Serialized)
174
192
  return value.quoted_id if value.respond_to?(:quoted_id)
175
193
  return value if sql_literal?(value)
176
194
  return 'NULL' if value.nil?
@@ -415,6 +433,9 @@ module ArJdbc
415
433
  @connection.tables(nil, current_schema)
416
434
  end
417
435
 
436
+ # @override
437
+ def supports_foreign_keys?; true end
438
+
418
439
  def truncate(table_name, name = nil)
419
440
  execute "TRUNCATE TABLE #{quote_table_name(table_name)}", name
420
441
  end
@@ -1,3 +1,4 @@
1
1
  require 'arjdbc'
2
2
  require 'arjdbc/firebird/adapter'
3
3
  require 'arjdbc/firebird/connection_methods'
4
+ ArJdbc.warn_unsupported_adapter 'firebird', [4, 2] # warns on AR >= 4.2
@@ -1,3 +1,5 @@
1
+ ArJdbc.load_java_part :Firebird
2
+
1
3
  module ArJdbc
2
4
  module Firebird
3
5
 
@@ -15,6 +17,11 @@ module ArJdbc
15
17
  Util::SerializedAttributes.setup /blob/i
16
18
  end
17
19
 
20
+ # @see ActiveRecord::ConnectionAdapters::JdbcAdapter#jdbc_connection_class
21
+ def self.jdbc_connection_class
22
+ ::ActiveRecord::ConnectionAdapters::FirebirdJdbcConnection
23
+ end
24
+
18
25
  # @see ActiveRecord::ConnectionAdapters::JdbcColumn#column_types
19
26
  def self.column_selector
20
27
  [ /firebird/i, lambda { |cfg, column| column.extend(Column) } ]
@@ -52,6 +59,9 @@ module ArJdbc
52
59
 
53
60
  end
54
61
 
62
+ # @see ActiveRecord::ConnectionAdapters::JdbcAdapter#jdbc_column_class
63
+ def jdbc_column_class; ::ActiveRecord::ConnectionAdapters::FirebirdColumn end
64
+
55
65
  # @see ArJdbc::ArelHelper::ClassMethods#arel_visitor_type
56
66
  def self.arel_visitor_type(config = nil)
57
67
  require 'arel/visitors/firebird'; ::Arel::Visitors::Firebird
@@ -120,6 +130,68 @@ module ArJdbc
120
130
  NATIVE_DATABASE_TYPES
121
131
  end
122
132
 
133
+ def initialize_type_map(m)
134
+ register_class_with_limit m, %r(binary)i, ActiveRecord::Type::Binary
135
+ register_class_with_limit m, %r(text)i, ActiveRecord::Type::Text
136
+
137
+ register_class_with_limit m, %r(date(?:\(.*?\))?$)i, DateType
138
+ register_class_with_limit m, %r(time(?:\(.*?\))?$)i, ActiveRecord::Type::Time
139
+
140
+ register_class_with_limit m, %r(float)i, ActiveRecord::Type::Float
141
+ register_class_with_limit m, %r(int)i, ActiveRecord::Type::Integer
142
+
143
+ m.alias_type %r(blob)i, 'binary'
144
+ m.alias_type %r(clob)i, 'text'
145
+ m.alias_type %r(double)i, 'float'
146
+
147
+ m.register_type(%r(decimal)i) do |sql_type|
148
+ scale = extract_scale(sql_type)
149
+ precision = extract_precision(sql_type)
150
+ if scale == 0
151
+ ActiveRecord::Type::Integer.new(precision: precision)
152
+ else
153
+ ActiveRecord::Type::Decimal.new(precision: precision, scale: scale)
154
+ end
155
+ end
156
+ m.alias_type %r(numeric)i, 'decimal'
157
+
158
+ register_class_with_limit m, %r(varchar)i, ActiveRecord::Type::String
159
+
160
+ m.register_type(%r(^char)i) do |sql_type|
161
+ precision = extract_precision(sql_type)
162
+ if Firebird.emulate_booleans? && precision == 1
163
+ ActiveRecord::Type::Boolean.new
164
+ else
165
+ ActiveRecord::Type::String.new(:precision => precision)
166
+ end
167
+ end
168
+
169
+ register_class_with_limit m, %r(datetime)i, ActiveRecord::Type::DateTime
170
+ register_class_with_limit m, %r(timestamp)i, TimestampType
171
+ end if AR42
172
+
173
+ def clear_cache!
174
+ super
175
+ reload_type_map
176
+ end if AR42
177
+
178
+ # @private
179
+ class DateType < ActiveRecord::Type::Date
180
+ # NOTE: quote still gets called ...
181
+ #def type_cast_for_database(value)
182
+ # if value.acts_like?(:date)
183
+ # "'#{value.strftime("%Y-%m-%d")}'"
184
+ # else
185
+ # super
186
+ # end
187
+ #end
188
+ end if AR42
189
+
190
+ # @private
191
+ class TimestampType < ActiveRecord::Type::DateTime
192
+ def type; :timestamp end
193
+ end if AR42
194
+
123
195
  def type_to_sql(type, limit = nil, precision = nil, scale = nil)
124
196
  case type
125
197
  when :integer
@@ -176,21 +248,31 @@ module ArJdbc
176
248
  end
177
249
 
178
250
  def add_limit_offset!(sql, options)
179
- if options[:limit]
180
- limit_string = "FIRST #{options[:limit]}"
181
- limit_string << " SKIP #{options[:offset]}" if options[:offset]
182
- sql.sub!(/\A(\s*SELECT\s)/i, '\&' + limit_string + ' ')
251
+ if limit = options[:limit]
252
+ insert_limit_offset!(sql, limit, options[:offset])
183
253
  end
184
254
  end
185
255
 
256
+ # @private
257
+ SELECT_RE = /\A(\s*SELECT\s)/i
258
+
259
+ def insert_limit_offset!(sql, limit, offset)
260
+ lim_off = ''
261
+ lim_off << "FIRST #{limit}" if limit
262
+ lim_off << " SKIP #{offset}" if offset
263
+ lim_off.strip!
264
+
265
+ sql.sub!(SELECT_RE, "\\&#{lim_off} ") unless lim_off.empty?
266
+ end
267
+
186
268
  # Should primary key values be selected from their corresponding
187
269
  # sequence before the insert statement?
188
270
  # @see #next_sequence_value
189
271
  # @override
190
272
  def prefetch_primary_key?(table_name = nil)
191
273
  return true if table_name.nil?
192
- table_name = table_name.to_s
193
- columns(table_name).count { |column| column.primary } == 1
274
+ primary_keys(table_name.to_s).size == 1
275
+ # columns(table_name).count { |column| column.primary } == 1
194
276
  end
195
277
 
196
278
  IDENTIFIER_LENGTH = 31 # usual DB meta-identifier: 31 chars maximum
@@ -201,8 +283,8 @@ module ArJdbc
201
283
  def column_name_length; IDENTIFIER_LENGTH; end
202
284
 
203
285
  def default_sequence_name(table_name, column = nil)
204
- # TODO: remove schema prefix if present (before truncating)
205
- "#{table_name.to_s[0, IDENTIFIER_LENGTH - 4]}_seq"
286
+ len = IDENTIFIER_LENGTH - 4
287
+ table_name.to_s.gsub (/(^|\.)([\w$-]{1,#{len}})([\w$-]*)$/), '\1\2_seq'
206
288
  end
207
289
 
208
290
  # Set the sequence to the max value of the table's column.
@@ -217,17 +299,18 @@ module ArJdbc
217
299
 
218
300
  def create_table(name, options = {})
219
301
  super(name, options)
220
- execute "CREATE GENERATOR #{name}_seq"
302
+ execute "CREATE GENERATOR #{default_sequence_name(name)}"
221
303
  end
222
304
 
223
305
  def rename_table(name, new_name)
224
306
  execute "RENAME #{name} TO #{new_name}"
225
- execute "UPDATE RDB$GENERATORS SET RDB$GENERATOR_NAME='#{new_name}_seq' WHERE RDB$GENERATOR_NAME='#{name}_seq'" rescue nil
307
+ name_seq, new_name_seq = default_sequence_name(name), default_sequence_name(new_name)
308
+ execute_quietly "UPDATE RDB$GENERATORS SET RDB$GENERATOR_NAME='#{new_name_seq}' WHERE RDB$GENERATOR_NAME='#{name_seq}'"
226
309
  end
227
310
 
228
311
  def drop_table(name, options = {})
229
312
  super(name)
230
- execute "DROP GENERATOR #{name}_seq" rescue nil
313
+ execute_quietly "DROP GENERATOR #{default_sequence_name(name)}"
231
314
  end
232
315
 
233
316
  def change_column(table_name, column_name, type, options = {})
@@ -326,3 +409,35 @@ module ArJdbc
326
409
  end
327
410
  FireBird = Firebird
328
411
  end
412
+
413
+ require 'arjdbc/util/quoted_cache'
414
+
415
+ module ActiveRecord::ConnectionAdapters
416
+
417
+ remove_const(:FirebirdAdapter) if const_defined?(:FirebirdAdapter)
418
+
419
+ class FirebirdAdapter < JdbcAdapter
420
+ include ::ArJdbc::Firebird
421
+ include ::ArJdbc::Util::QuotedCache
422
+
423
+ # By default, the FirebirdAdapter will consider all columns of type
424
+ # <tt>char(1)</tt> as boolean. If you wish to disable this :
425
+ #
426
+ # ActiveRecord::ConnectionAdapters::FirebirdAdapter.emulate_booleans = false
427
+ #
428
+ def self.emulate_booleans?; ::ArJdbc::Firebird.emulate_booleans?; end
429
+ def self.emulate_booleans; ::ArJdbc::Firebird.emulate_booleans?; end # oracle-enhanced
430
+ def self.emulate_booleans=(emulate); ::ArJdbc::Firebird.emulate_booleans = emulate; end
431
+
432
+ def initialize(*args)
433
+ ::ArJdbc::Firebird.initialize!
434
+ super
435
+ end
436
+
437
+ end
438
+
439
+ class FirebirdColumn < JdbcColumn
440
+ include ::ArJdbc::Firebird::Column
441
+ end
442
+
443
+ end