Module: ActiveRecord::ConnectionAdapters::Quoting::ClassMethods
Do not use. This module is for internal use only.
Relationships & Source Files | |
Defined in: | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb |
Instance Method Summary
-
#column_name_matcher
::Regexp
for column names (with or without a table name prefix). -
#column_name_with_order_matcher
::Regexp
for column names with order (with or without a table name prefix, with or without various order modifiers). -
#quote_column_name(column_name)
Quotes the column name.
-
#quote_table_name(table_name)
Quotes the table name.
Instance Method Details
#column_name_matcher
::Regexp
for column names (with or without a table name prefix). Matches the following:
"#{table_name}.#{column_name}"
"#{column_name}"
# File 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb', line 18
def column_name_matcher / \A ( (?: # table_name.column_name | function(one or no argument) ((?:\w\.)?\w | \w+\((?:|\g<2>)\)) ) (?:(?:\sAS)?\s\w+)? ) (?:\s*,\s*\g<1>)* \z /ix end
#column_name_with_order_matcher
::Regexp
for column names with order (with or without a table name prefix, with or without various order modifiers). Matches the following:
"#{table_name}.#{column_name}"
"#{table_name}.#{column_name} #{direction}"
"#{table_name}.#{column_name} #{direction} NULLS FIRST"
"#{table_name}.#{column_name} NULLS LAST"
"#{column_name}"
"#{column_name} #{direction}"
"#{column_name} #{direction} NULLS FIRST"
"#{column_name} NULLS LAST"
# File 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb', line 44
def column_name_with_order_matcher / \A ( (?: # table_name.column_name | function(one or no argument) ((?:\w\.)?\w | \w+\((?:|\g<2>)\)) ) (?:\sASC|\sDESC)? (?:\sNULLS\s(?:FIRST|LAST))? ) (?:\s*,\s*\g<1>)* \z /ix end
#quote_column_name(column_name)
Quotes the column name. Must be implemented by subclasses
# File 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb', line 61
def quote_column_name(column_name) raise NotImplementedError end
#quote_table_name(table_name)
Quotes the table name. Defaults to column name quoting.
# File 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb', line 66
def quote_table_name(table_name) quote_column_name(table_name) end