Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 5459

Show
Ignore:
Timestamp:
11/07/06 19:56:01 (2 years ago)
Author:
bitsweat
Message:

Firebird: decimal/numeric support. Closes #6408.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r5452 r5459  
    11*SVN* 
     2 
     3* Firebird: decimal/numeric support.  #6408 [macrnic] 
    24 
    35* make add_order a tad faster. #6567 [Stefan Kaes] 
  • trunk/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb

    r4594 r5459  
    5151        @default = parse_default(default_source) if default_source 
    5252        @limit = decide_limit(length) 
    53         @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale 
     53        @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale.abs 
    5454      end 
    5555 
     
    294294          :text        => { :name => "blob sub_type text" }, 
    295295          :integer     => { :name => "bigint" }, 
     296          :decimal     => { :name => "decimal" }, 
     297          :numeric     => { :name => "numeric" }, 
    296298          :float       => { :name => "float" }, 
    297299          :datetime    => { :name => "timestamp" }, 
     
    535537 
    536538      def remove_index(table_name, options) #:nodoc: 
    537         if Hash === options 
    538           index_name = options[:name] 
    539         else 
    540           index_name = "#{table_name}_#{options}_index" 
    541         end 
    542         execute "DROP INDEX #{index_name}" 
     539        execute "DROP INDEX #{quote_column_name(index_name(table_name, options))}" 
    543540      end 
    544541 
     
    569566      end 
    570567 
    571       def type_to_sql(type, limit = nil) # :nodoc: 
     568      def type_to_sql(type, limit = nil, precision = nil, scale = nil) # :nodoc: 
    572569        case type 
    573570          when :integer then integer_sql_type(limit) 
    574571          when :float   then float_sql_type(limit) 
    575           when :string  then super 
    576           else super(type
     572          when :string  then super(type, limit, precision, scale) 
     573          else super(type, limit, precision, scale
    577574        end 
    578575      end 
  • trunk/activerecord/test/migration_test_firebird.rb

    r4594 r5459  
    9292    assert !@connection.tables.include?("foo") 
    9393    assert @connection.tables.include?("bar") 
    94     assert_equal "bar_baz_index", @connection.indexes("bar").first.name 
     94    assert_equal "index_bar_on_baz", @connection.indexes("bar").first.name 
    9595    assert_equal 100, FireRuby::Generator.new("bar_seq", @fireruby_connection).last 
    9696    assert_equal 100, @connection.select_one("SELECT COUNT(*) FROM bar")["count"]