diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-08 20:35:56 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-08 20:35:56 +0000 |
commit | 2a12b56841bd6fd3998050e7677a1b2c08257479 (patch) | |
tree | 4fcd51578ac322228b2f6a44ce2344ab309992aa /activerecord/lib/active_record/connection_adapters/sybase_adapter.rb | |
parent | 71234daef1517cf190adfc5978e56882d2a57ea6 (diff) | |
download | rails-2a12b56841bd6fd3998050e7677a1b2c08257479.tar.gz rails-2a12b56841bd6fd3998050e7677a1b2c08257479.tar.bz2 rails-2a12b56841bd6fd3998050e7677a1b2c08257479.zip |
r4704@asus: jeremy | 2006-06-27 12:00:19 -0700
decimal
r4705@asus: jeremy | 2006-06-27 12:20:47 -0700
current_adapter? checks whether any of its arguments is the name of the current adapter class
r4834@asus: jeremy | 2006-07-08 13:08:24 -0700
Room to float.
r4835@asus: jeremy | 2006-07-08 13:09:18 -0700
Give lock test a few chances.
r4836@asus: jeremy | 2006-07-08 13:12:05 -0700
Numeric and decimal columns map to BigDecimal instead of Float. Those with scale 0 map to Integer. Closes #5454.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4596 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/sybase_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sybase_adapter.rb | 26 |
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) |