123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::ConnectionAdapters::Quoting::ClassMethods

Do not use. This module is for internal use only.

Instance Method Summary

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}"
[ GitHub ]

  
# 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"
[ GitHub ]

  
# 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

Raises:

  • (NotImplementedError)
[ GitHub ]

  
# 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.

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb', line 66

def quote_table_name(table_name)
  quote_column_name(table_name)
end