diff -Naur a/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb b/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb --- a/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb 2008-12-08 18:58:45 +0200 +++ b/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb 2008-12-08 19:03:09 +0200 @@ -15,25 +15,28 @@ # The original implementation of this had a bug, which modifies native_database_types. # This version allows us to cache that value. def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc: - native = native_database_types[type.to_s.downcase.to_sym] - column_type_sql = native.is_a?(Hash) ? native[:name] : native - if type == :decimal # ignore limit, use precison and scale - precision ||= native[:precision] - scale ||= native[:scale] - if precision - if scale - column_type_sql += "(#{precision},#{scale})" + if native = native_database_types[type] + column_type_sql = native.is_a?(Hash) ? native[:name] : native + if type == :decimal # ignore limit, use precision and scale + precision ||= native[:precision] + scale ||= native[:scale] + if precision + if scale + column_type_sql << "(#{precision},#{scale})" + else + column_type_sql << "(#{precision})" + end else - column_type_sql += "(#{precision})" + raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale if specified" if scale end + column_type_sql else - raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale if specified" if scale + limit ||= native[:limit] + column_type_sql << "(#{limit})" if limit + column_type_sql end - column_type_sql else - limit ||= native[:limit] - column_type_sql += "(#{limit})" if limit - column_type_sql + column_type_sql = type end end end