diff options
author | José Valim <jose.valim@gmail.com> | 2010-07-25 20:46:42 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-25 20:46:42 +0200 |
commit | ff0d842454571d78addd1fe9d4f232b600881b1a (patch) | |
tree | a9c07676d888d14ab5f2298dfe676fbb0ab3eb26 /activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | |
parent | 0d0e79398308e6147e59d99a48c7e6d952e5848c (diff) | |
download | rails-ff0d842454571d78addd1fe9d4f232b600881b1a.tar.gz rails-ff0d842454571d78addd1fe9d4f232b600881b1a.tar.bz2 rails-ff0d842454571d78addd1fe9d4f232b600881b1a.zip |
Revert the previous three commits.
* AS::Notifications#instrument should not measure anything, it is not its responsibility;
* Adding another argument to AS::Notifications#instrument API needs to be properly discussed;
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 618560087e..c07ba2ac74 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -36,15 +36,11 @@ module ActiveRecord define_callbacks :checkout, :checkin - @@row_even = true - def initialize(connection, logger = nil) #:nodoc: @active = nil @connection, @logger = connection, logger - @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 @@ -93,11 +89,6 @@ module ActiveRecord false end - def reset_runtime #:nodoc: - rt, @runtime = @runtime, 0 - rt - end - # QUOTING ================================================== # Override to return the quoted table name. Defaults to column quoting. @@ -200,15 +191,10 @@ module ActiveRecord def log(sql, name) name ||= "SQL" - info = {} - - result = @instrumenter.instrument("sql.active_record", - {:sql => sql, :name => name, :connection_id => object_id}, info) do + ActiveSupport::Notifications.instrument("sql.active_record", + :sql => sql, :name => name, :connection_id => object_id) do yield end - @runtime += info[:elapsed] - - result rescue Exception => e message = "#{e.class.name}: #{e.message}: #{sql}" @logger.debug message if @logger |