aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-07-08 20:35:56 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-07-08 20:35:56 +0000
commit2a12b56841bd6fd3998050e7677a1b2c08257479 (patch)
tree4fcd51578ac322228b2f6a44ce2344ab309992aa /activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
parent71234daef1517cf190adfc5978e56882d2a57ea6 (diff)
downloadrails-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/abstract/quoting.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/quoting.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
index 05beddac75..1c1b00252c 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
@@ -16,13 +16,15 @@ module ActiveRecord
else
"'#{quote_string(value)}'" # ' (for ruby-mode)
end
- when NilClass then "NULL"
- when TrueClass then (column && column.type == :integer ? '1' : quoted_true)
- when FalseClass then (column && column.type == :integer ? '0' : quoted_false)
- when Float, Fixnum, Bignum then value.to_s
- when Date then "'#{value.to_s}'"
- when Time, DateTime then "'#{quoted_date(value)}'"
- else "'#{quote_string(value.to_yaml)}'"
+ when NilClass then "NULL"
+ when TrueClass then (column && column.type == :integer ? '1' : quoted_true)
+ when FalseClass then (column && column.type == :integer ? '0' : quoted_false)
+ when Float, Fixnum, Bignum then value.to_s
+ # BigDecimals need to be output in a non-normalized form and quoted.
+ when BigDecimal then value.to_s('F')
+ when Date then "'#{value.to_s}'"
+ when Time, DateTime then "'#{quoted_date(value)}'"
+ else "'#{quote_string(value.to_yaml)}'"
end
end