diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-04-06 02:56:29 -0300 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-04-06 02:56:29 -0300 |
commit | ce2cc069db41d9358c34a4f23ca2b82b5a682de2 (patch) | |
tree | 95349ec32fa400e07f93e2a16ef3a36e3efcd886 /activerecord/lib/active_record/connection_adapters/mysql/quoting.rb | |
parent | 9c2945f4cc1017fc9424f2e425e4820da1ef33b0 (diff) | |
parent | cc7f39aa63d63928df33b77add34d9f1acb782f1 (diff) | |
download | rails-ce2cc069db41d9358c34a4f23ca2b82b5a682de2.tar.gz rails-ce2cc069db41d9358c34a4f23ca2b82b5a682de2.tar.bz2 rails-ce2cc069db41d9358c34a4f23ca2b82b5a682de2.zip |
Merge pull request #24374 from kamipo/move_quoting_methods_to_quoting_module
Move quoting methods to `Quoting` module
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb')
-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) |