module ActiveRecord::ConnectionAdapters::MySQL::Quoting
def column_name_matcher
def column_name_matcher COLUMN_NAME end
def column_name_with_order_matcher
def column_name_with_order_matcher COLUMN_NAME_WITH_ORDER end
def quote_bound_value(value)
def quote_bound_value(value) case value when Rational quote(value.to_f.to_s) when Numeric, ActiveSupport::Duration quote(value.to_s) when BigDecimal quote(value.to_s("F")) when true "'1'" when false "'0'" else quote(value) end end
def quote_column_name(name)
def quote_column_name(name) self.class.quoted_column_names[name] ||= "`#{super.gsub('`', '``')}`" end
def quote_table_name(name)
def quote_table_name(name) self.class.quoted_table_names[name] ||= super.gsub(".", "`.`").freeze end
def quoted_binary(value)
def quoted_binary(value) "x'#{value.hex}'" end
def quoted_date(value)
def quoted_date(value) if supports_datetime_with_precision? super else super.sub(/\.\d{6}\z/, "") end end
def type_cast(value) # :nodoc:
of Strings since mysql2 is able to handle those classes more efficiently.
Override +type_cast+ we pass to mysql2 Date and Time objects instead
def type_cast(value) # :nodoc: case value when ActiveSupport::TimeWithZone # We need to check explicitly for ActiveSupport::TimeWithZone because # we need to transform it to Time objects but we don't want to # transform Time objects to themselves. if ActiveRecord.default_timezone == :utc value.getutc else value.getlocal end when Date, Time value else super end end
def unquoted_false
def unquoted_false 0 end
def unquoted_true
def unquoted_true 1 end