Changeset 4424
- Timestamp:
- 06/03/06 21:57:03 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r4422 r4424 1 1 *SVN* 2 3 * Fixed issues with BLOB limits, charsets, and booleans for Firebird #5194, #5191, #5189 [kennethkunz@gmail.com] 2 4 3 5 * Fixed usage of :limit and with_scope when the association in scope is a 1:m #5208 [alex@purefiction.net] trunk/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb
r4421 r4424 5 5 module FireRuby # :nodoc: all 6 6 class Database 7 def self.new_from_params(database, host, port, service) 8 db_string = "" 9 if host 10 db_string << host 11 db_string << "/#{service || port}" if service || port 12 db_string << ":" 13 end 14 db_string << database 15 new(db_string) 7 def self.new_from_params(database, host, port, service, charset) 8 host_string = [host, service, port].compact.first(2).join("/") if host 9 db_string = [host_string, database].join(":") 10 db = new(db_string) 11 db.character_set = charset 12 db 16 13 end 17 14 end … … 27 24 'to be running an older version -- please update FireRuby (gem install fireruby).' 28 25 end 29 config = config.symbolize_keys26 config.symbolize_keys! 30 27 unless config.has_key?(:database) 31 28 raise ArgumentError, "No database specified. Missing argument: database." 32 29 end 33 options = config[:charset] ? { CHARACTER_SET => config[:charset] } : {}34 connection_params = [config[:username], config[:password], options]35 db = FireRuby::Database.new_from_params(* config.values_at(:database, :host, :port, :service))30 db_params = config.values_at(:database, :host, :port, :service, :charset) 31 connection_params = config.values_at(:username, :password) 32 db = FireRuby::Database.new_from_params(*db_params) 36 33 connection = db.connect(*connection_params) 37 34 ConnectionAdapters::FirebirdAdapter.new(connection, logger, connection_params) … … 48 45 super(name.downcase, nil, @firebird_type, !null_flag) 49 46 @default = parse_default(default_source) if default_source 50 @limit = type == 'BLOB' ? BLOB_MAX_LENGTH : length47 @limit = @firebird_type == 'BLOB' ? BLOB_MAX_LENGTH : length 51 48 @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale 52 49 end … … 77 74 end 78 75 79 def type_cast(value) 80 if type == :boolean 81 value == true or value == ActiveRecord::ConnectionAdapters::FirebirdAdapter.boolean_domain[:true] 82 else 83 super 84 end 76 def self.value_to_boolean(value) 77 %W(#{FirebirdAdapter.boolean_domain[:true]} true t 1).include? value.to_s.downcase 85 78 end 86 79 trunk/activerecord/test/connections/native_firebird/connection.rb
r3182 r4424 13 13 :username => "rails", 14 14 :password => "rails", 15 :database => db1 15 :database => db1, 16 :charset => "UTF8" 16 17 ) 17 18