123456789_123456789_123456789_123456789_123456789_

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

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

Instance Method Summary

Instance Method Details

#column_name_matcher

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 15

def column_name_matcher
  /
    \A
    (
      (?:
        # `table_name`.`column_name` | function(one or no argument)
        ((?:\w\.|`\w`\.)?(?:\w|`\w`) | \w+\((?:|\g<2>)\))
      )
      (?:(?:\sAS)?\s(?:\w|`\w`))?
    )
    (?:\s*,\s*\g<1>)*
    \z
  /ix
end

#column_name_with_order_matcher

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 30

def column_name_with_order_matcher
  /
    \A
    (
      (?:
        # `table_name`.`column_name` | function(one or no argument)
        ((?:\w\.|`\w`\.)?(?:\w|`\w`) | \w+\((?:|\g<2>)\))
      )
      (?:\sCOLLATE\s(?:\w|"\w"))?
      (?:\sASC|\sDESC)?
    )
    (?:\s*,\s*\g<1>)*
    \z
  /ix
end

#quote_column_name(name)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 46

def quote_column_name(name)
  QUOTED_COLUMN_NAMES[name] ||= "`#{name.to_s.gsub('`', '``')}`".freeze
end

#quote_table_name(name)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/mysql/quoting.rb', line 50

def quote_table_name(name)
  QUOTED_TABLE_NAMES[name] ||= "`#{name.to_s.gsub('`', '``').gsub(".", "`.`")}`".freeze
end