mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
ignoring certain SQL when using Oracle
This commit is contained in:
parent
6367e95867
commit
fa4686243c
1 changed files with 4 additions and 0 deletions
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue