mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
ignoring certain SQL when using Oracle
This commit is contained in:
@@ -48,6 +48,10 @@ end
|
||||
ActiveRecord::Base.connection.class.class_eval do
|
||||
IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /SHOW FIELDS/]
|
||||
|
||||
# FIXME: this needs to be refactored so specific database can add their own
|
||||
# ignored SQL. This ignored SQL is for Oracle.
|
||||
IGNORED_SQL.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from ((all|user)_tab_columns|(all|user)_triggers|(all|user)_constraints)/im]
|
||||
|
||||
def execute_with_query_record(sql, name = nil, &block)
|
||||
$queries_executed ||= []
|
||||
$queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r }
|
||||
|
||||
Reference in New Issue
Block a user