Class: ArQueryMatchers::Queries::CreateCounter::CreateQueryFilter
- Inherits:
-
QueryFilter
- Object
- QueryFilter
- ArQueryMatchers::Queries::CreateCounter::CreateQueryFilter
- Defined in:
- lib/ar_query_matchers/queries/create_counter.rb
Constant Summary collapse
- TABLE_NAME_SQL_PATTERN =
Matches unnamed SQL operations like the following: “INSERT INTO ‘company_approval_details` …”
/INSERT INTO [`"](?<table_name>[^`"]+)[`"]/
Instance Method Summary collapse
Instance Method Details
#filter_map(_name, sql) ⇒ Object
22 23 24 25 26 27 |
# 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 |