Module: ActiveRecord::ConnectionAdapters::Cubrid2::Quoting
- Included in:
- AbstractCubrid2Adapter
- Defined in:
- lib/active_record/connection_adapters/cubrid2/quoting.rb
Overview
:nodoc:
Instance Method Summary collapse
- #column_name_matcher ⇒ Object
- #column_name_with_order_matcher ⇒ Object
-
#quote(value) ⇒ Object
:nodoc:.
-
#quote_column_name(name) ⇒ Object
def quote_string(s) super end.
-
#quote_schema_name(name) ⇒ Object
Quotes schema names for use in SQL queries.
- #quote_table_name(name) ⇒ Object
- #quote_table_name_for_assignment(_table, attr) ⇒ Object
- #quoted_binary(value) ⇒ Object
- #quoted_date(value) ⇒ Object
- #unquoted_false ⇒ Object
-
#unquoted_true ⇒ Object
def visit_Arel_Attributes_Attribute(o, collector) join_name = o.relation.table_alias || o.relation.name collector << quote_table_name(join_name) << “.” << quote_column_name(o.name) end.
Instance Method Details
#column_name_matcher ⇒ Object
76 77 78 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 76 def column_name_matcher COLUMN_NAME end |
#column_name_with_order_matcher ⇒ Object
80 81 82 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 80 def column_name_with_order_matcher COLUMN_NAME_WITH_ORDER end |
#quote(value) ⇒ Object
:nodoc:
7 8 9 10 11 12 13 14 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 7 def quote(value) # :nodoc: case value when ActiveRecord::ConnectionAdapters::ColumnDefinition quote(value.name) else super end end |
#quote_column_name(name) ⇒ Object
def quote_string(s)
super
end
20 21 22 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 20 def quote_column_name(name) self.class.quoted_column_names[name] ||= "`#{super.gsub('`', '``')}`" end |
#quote_schema_name(name) ⇒ Object
Quotes schema names for use in SQL queries.
35 36 37 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 35 def quote_schema_name(name) quote_table_name(name) end |
#quote_table_name(name) ⇒ Object
24 25 26 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 24 def quote_table_name(name) self.class.quoted_table_names[name] ||= super.gsub('.', '`.`').freeze end |
#quote_table_name_for_assignment(_table, attr) ⇒ Object
39 40 41 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 39 def quote_table_name_for_assignment(_table, attr) quote_column_name(attr) end |
#quoted_binary(value) ⇒ Object
71 72 73 74 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 71 def quoted_binary(value) # https://www.cubrid.org/manual/ko/11.2/sql/literal.html#id5 "X'#{value.hex}'" end |
#quoted_date(value) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 63 def quoted_date(value) if supports_datetime_with_precision? super else super.sub(/\.\d{6}\z/, '') end end |
#unquoted_false ⇒ Object
59 60 61 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 59 def unquoted_false 0 end |
#unquoted_true ⇒ Object
def visit_Arel_Attributes_Attribute(o, collector)
join_name = o.relation.table_alias || o.relation.name
collector << quote_table_name(join_name) << "." << quote_column_name(o.name)
end
55 56 57 |
# File 'lib/active_record/connection_adapters/cubrid2/quoting.rb', line 55 def unquoted_true 1 end |