mirror of https://github.com/rails/rails
moving ignored regexp to the instance
This commit is contained in:
parent
38a8f7f8ba
commit
a505b13774
|
@ -65,20 +65,22 @@ module ActiveRecord
|
|||
# ignored SQL. This ignored SQL is for Oracle.
|
||||
ignored_sql.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from all_triggers/im]
|
||||
|
||||
cattr_accessor :ignored_sql_regexp
|
||||
self.ignored_sql_regexp = Regexp.union ignored_sql
|
||||
|
||||
cattr_accessor :log
|
||||
self.log = []
|
||||
|
||||
attr_reader :ignore
|
||||
|
||||
def initialize(ignore = Regexp.union(self.class.ignored_sql))
|
||||
@ignore = ignore
|
||||
end
|
||||
|
||||
def call(name, start, finish, message_id, values)
|
||||
sql = values[:sql]
|
||||
|
||||
# FIXME: this seems bad. we should probably have a better way to indicate
|
||||
# the query was cached
|
||||
unless 'CACHE' == values[:name]
|
||||
self.class.log << sql unless self.class.ignored_sql_regexp =~ sql
|
||||
end
|
||||
return if 'CACHE' == values[:name] || ignore =~ sql
|
||||
self.class.log << sql
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue