diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/mysql')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql/quoting.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb index 7c5980da2a..fbab654112 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb @@ -2,6 +2,8 @@ module ActiveRecord module ConnectionAdapters module MySQL module Quoting # :nodoc: + QUOTED_TRUE, QUOTED_FALSE = '1', '0' + def quote_column_name(name) @quoted_column_names[name] ||= "`#{super.gsub('`', '``')}`" end @@ -10,6 +12,30 @@ module ActiveRecord @quoted_table_names[name] ||= super.gsub('.', '`.`') end + def quoted_true + QUOTED_TRUE + end + + def unquoted_true + 1 + end + + def quoted_false + QUOTED_FALSE + end + + def unquoted_false + 0 + end + + def quoted_date(value) + if supports_datetime_with_precision? + super + else + super.sub(/\.\d{6}\z/, '') + end + end + private def _quote(value) |