Module: Cucumber::ThinkingSphinx::SqlLogger

Defined in:
lib/cucumber/thinking_sphinx/sql_logger.rb

Constant Summary collapse

IGNORED_SQL =
[
  /^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/,
  /^SELECT @@ROWCOUNT/, /^SHOW FIELDS/
]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/cucumber/thinking_sphinx/sql_logger.rb', line 4

def self.included(base)
  base.send :alias_method_chain, :execute, :query_record
end

Instance Method Details

#execute_with_query_record(sql, name = nil, &block) ⇒ Object



13
14
15
16
17
# File 'lib/cucumber/thinking_sphinx/sql_logger.rb', line 13

def execute_with_query_record(sql, name = nil, &block)
  $queries_executed ||= []
  $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r }
  execute_without_query_record(sql, name, &block)
end