Module: ActiveRecord::ConnectionAdapters::MySQL::Quoting
Do not use. This module is for internal use only.
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::ActiveSupport::Concern
|
|
Defined in: | activerecord/lib/active_record/connection_adapters/mysql/quoting.rb |
Constant Summary
-
QUOTED_COLUMN_NAMES =
# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 11Concurrent::Map.new
-
QUOTED_TABLE_NAMES =
# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 12Concurrent::Map.new
Class Method Summary
::ActiveSupport::Concern
- Extended
class_methods | Define class methods from given block. |
included | Evaluate given block in context of base class, so that you can write class macros here. |
prepended | Evaluate given block in context of base class, so that you can write class macros here. |
append_features, prepend_features |
Instance Method Summary
- #cast_bound_value(value)
- #quoted_binary(value)
-
#type_cast(value)
Override #type_cast we pass to mysql2
::Date
and::Time
objects instead of Strings since::ActiveRecord::ConnectionAdapters::MySQL
adapters are able to handle those classes more efficiently. - #unquote_identifier(identifier)
- #unquoted_false
- #unquoted_true
Instance Method Details
#cast_bound_value(value)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 55
def cast_bound_value(value) case value when Rational value.to_f.to_s when Numeric value.to_s when BigDecimal value.to_s("F") when true "1" when false "0" else value end end
#quoted_binary(value)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 80
def quoted_binary(value) "x'#{value.hex}'" end
#type_cast(value)
Override type_cast
we pass to mysql2 ::Date
and ::Time
objects instead of Strings since ::ActiveRecord::ConnectionAdapters::MySQL
adapters are able to handle those classes more efficiently.
# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 94
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 default_timezone == :utc value.getutc else value.getlocal end when Date, Time value else super end end
#unquote_identifier(identifier)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 84
def unquote_identifier(identifier) if identifier && identifier.start_with?("`") identifier[1..-2] else identifier end end
#unquoted_false
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 76
def unquoted_false 0 end
#unquoted_true
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 72
def unquoted_true 1 end