Class: ArQueryMatchers::Queries::UpdateCounter::UpdateQueryFilter
- Inherits:
-
QueryFilter
- Object
- QueryFilter
- ArQueryMatchers::Queries::UpdateCounter::UpdateQueryFilter
- Defined in:
- lib/ar_query_matchers/queries/update_counter.rb
Constant Summary collapse
- TABLE_NAME_SQL_PATTERN =
Matches unnamed SQL operations like the following: “UPDATE ‘bank_account_verifications` …”
/UPDATE [`"](?<table_name>[^`"]+)[`"]/
Instance Method Summary collapse
Instance Method Details
#filter_map(_name, sql) ⇒ Object
22 23 24 25 26 |
# File 'lib/ar_query_matchers/queries/update_counter.rb', line 22 def filter_map(_name, sql) # for updates, name is always 'SQL', we have to rely on pattern matching on the query string instead. select_from_table = sql.match(TABLE_NAME_SQL_PATTERN) TableName.new(select_from_table[:table_name]) if select_from_table end |