提交 fc088d4e 编写于 作者: A Aaron Patterson

cache the instrumentor for a speed gain

上级 b7e0408c
......@@ -44,6 +44,7 @@ def initialize(connection, logger = nil) #:nodoc:
@runtime = 0
@query_cache_enabled = false
@query_cache = {}
@instrumenter = ActiveSupport::Notifications.instrumenter
end
# Returns the human-readable name of the adapter. Use mixed case - one
......@@ -199,10 +200,9 @@ def current_savepoint_name
def log(sql, name)
name ||= "SQL"
instrumenter = ActiveSupport::Notifications.instrumenter
info = {}
result = instrumenter.instrument("sql.active_record",
result = @instrumenter.instrument("sql.active_record",
{:sql => sql, :name => name, :connection_id => object_id}, info) do
yield
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册