aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/sybase_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sybase_adapter.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb b/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb
index e464fc56ad..dc1cce451a 100644
--- a/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb
@@ -86,14 +86,15 @@ module ActiveRecord
def simplified_type(field_type)
case field_type
- when /int|bigint|smallint|tinyint/i then :integer
- when /float|double|decimal|money|numeric|real|smallmoney/i then :float
- when /text|ntext/i then :text
- when /binary|image|varbinary/i then :binary
- when /char|nchar|nvarchar|string|varchar/i then :string
- when /bit/i then :boolean
- when /datetime|smalldatetime/i then :datetime
- else super
+ when /int|bigint|smallint|tinyint/i then :integer
+ when /float|double|real/i then :float
+ when /decimal|money|numeric|smallmoney/i then :decimal
+ when /text|ntext/i then :text
+ when /binary|image|varbinary/i then :binary
+ when /char|nchar|nvarchar|string|varchar/i then :string
+ when /bit/i then :boolean
+ when /datetime|smalldatetime/i then :datetime
+ else super
end
end
@@ -137,6 +138,7 @@ module ActiveRecord
:text => { :name => "text" },
:integer => { :name => "int" },
:float => { :name => "float", :limit => 8 },
+ :decimal => { :name => "decimal" },
:datetime => { :name => "datetime" },
:timestamp => { :name => "timestamp" },
:time => { :name => "time" },
@@ -287,18 +289,16 @@ module ActiveRecord
when NilClass then (column && column.type == :boolean) ? '0' : "NULL"
when TrueClass then '1'
when FalseClass then '0'
- when Float, Fixnum, Bignum
- force_numeric?(column) ? value.to_s : "'#{value.to_s}'"
- when Date then "'#{value.to_s}'"
+ when Float, Fixnum, Bignum then force_numeric?(column) ? value.to_s : "'#{value.to_s}'"
when Time, DateTime then "'#{value.strftime("%Y-%m-%d %H:%M:%S")}'"
- else "'#{quote_string(value.to_yaml)}'"
+ else super
end
end
# True if column is explicitly declared non-numeric, or
# if column is nil (not specified).
def force_numeric?(column)
- (column.nil? || [:integer, :float].include?(column.type))
+ (column.nil? || [:integer, :float, :decimal].include?(column.type))
end
def quote_string(s)