Permalink
Browse files

ignoring certain SQL when using Oracle

  • Loading branch information...
1 parent 6367e95 commit fa4686243cb4850297c865f3e1de56e790ebc0ec @tenderlove tenderlove committed Nov 3, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 activerecord/test/cases/helper.rb
@@ -48,6 +48,10 @@ def with_active_record_default_timezone(zone)
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 }

0 comments on commit fa46862

Please sign in to comment.