Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert queries oracle fix for 3 0 #1554

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions activerecord/test/cases/helper.rb
Expand Up @@ -41,6 +41,19 @@ def execute_with_query_record(sql, name = nil, &block)
alias_method_chain :execute, :query_record
end

# Oracle specific ignored SQLs
ActiveRecord::Base.connection.class.class_eval do
IGNORED_SELECT_SQL = [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from ((all|user)_tab_columns|(all|user)_triggers|(all|user)_constraints)/im]

def select_with_query_record(sql, name = nil)
$queries_executed ||= []
$queries_executed << sql unless IGNORED_SELECT_SQL.any? { |r| sql =~ r }
select_without_query_record(sql, name)
end

alias_method_chain :select, :query_record
end if ENV['ARCONN'] == 'oracle'

ActiveRecord::Base.connection.class.class_eval {
attr_accessor :column_calls, :column_calls_by_table

Expand Down