class ArQueryMatchers::Queries::CreateCounter::CreateQueryFilter

Constants

TABLE_NAME_SQL_PATTERN

Matches unnamed SQL operations like the following: “INSERT INTO `company_approval_details` …”

Public Instance Methods

filter_map(_name, sql) click to toggle source
# File lib/ar_query_matchers/queries/create_counter.rb, line 22
def filter_map(_name, sql)
  # for inserts, name is always 'SQL', we have to rely on pattern matching the query string.
  select_from_table = sql.match(TABLE_NAME_SQL_PATTERN)

  TableName.new(select_from_table[:table_name]) if select_from_table
end