diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-07 19:56:01 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-07 19:56:01 +0000 |
commit | 66b92abfc374e7abec71e0e9facee1128c2657da (patch) | |
tree | 5b85d6cce0416826e57acbdad38cbde66db5e27d | |
parent | fbccde947553e17083d91aee49b303191f729807 (diff) | |
download | rails-66b92abfc374e7abec71e0e9facee1128c2657da.tar.gz rails-66b92abfc374e7abec71e0e9facee1128c2657da.tar.bz2 rails-66b92abfc374e7abec71e0e9facee1128c2657da.zip |
Firebird: decimal/numeric support. Closes #6408.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5459 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/firebird_adapter.rb | 17 | ||||
-rw-r--r-- | activerecord/test/migration_test_firebird.rb | 2 |
3 files changed, 10 insertions, 11 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 4726464980..d61e3e509d 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Firebird: decimal/numeric support. #6408 [macrnic] + * make add_order a tad faster. #6567 [Stefan Kaes] * Find with :include respects scoped :order. #5850 diff --git a/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb b/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb index 6a8ef03c8a..36222e4b0b 100644 --- a/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb @@ -50,7 +50,7 @@ module ActiveRecord @default = parse_default(default_source) if default_source @limit = decide_limit(length) - @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale + @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale.abs end def type @@ -293,6 +293,8 @@ module ActiveRecord :string => { :name => "varchar", :limit => 255 }, :text => { :name => "blob sub_type text" }, :integer => { :name => "bigint" }, + :decimal => { :name => "decimal" }, + :numeric => { :name => "numeric" }, :float => { :name => "float" }, :datetime => { :name => "timestamp" }, :timestamp => { :name => "timestamp" }, @@ -534,12 +536,7 @@ module ActiveRecord end def remove_index(table_name, options) #:nodoc: - if Hash === options - index_name = options[:name] - else - index_name = "#{table_name}_#{options}_index" - end - execute "DROP INDEX #{index_name}" + execute "DROP INDEX #{quote_column_name(index_name(table_name, options))}" end def rename_table(name, new_name) # :nodoc: @@ -568,12 +565,12 @@ module ActiveRecord super << ";\n" end - def type_to_sql(type, limit = nil) # :nodoc: + def type_to_sql(type, limit = nil, precision = nil, scale = nil) # :nodoc: case type when :integer then integer_sql_type(limit) when :float then float_sql_type(limit) - when :string then super - else super(type) + when :string then super(type, limit, precision, scale) + else super(type, limit, precision, scale) end end diff --git a/activerecord/test/migration_test_firebird.rb b/activerecord/test/migration_test_firebird.rb index 9d4b80c839..92d531b75b 100644 --- a/activerecord/test/migration_test_firebird.rb +++ b/activerecord/test/migration_test_firebird.rb @@ -91,7 +91,7 @@ class FirebirdMigrationTest < Test::Unit::TestCase assert_nothing_raised { @connection.rename_table :foo, :bar } assert !@connection.tables.include?("foo") assert @connection.tables.include?("bar") - assert_equal "bar_baz_index", @connection.indexes("bar").first.name + assert_equal "index_bar_on_baz", @connection.indexes("bar").first.name assert_equal 100, FireRuby::Generator.new("bar_seq", @fireruby_connection).last assert_equal 100, @connection.select_one("SELECT COUNT(*) FROM bar")["count"] ensure |