aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
diff options
context:
space:
mode:
authorJonathan Viney <jonathan.viney@gmail.com>2008-07-02 16:01:26 +1200
committerMichael Koziarski <michael@koziarski.com>2008-07-15 21:25:12 +0200
commit4f72feb84c25b54f66c7192c788b7fd965f2d493 (patch)
treecaa8cf9cb15c786dc627e438122da822986d8f6e /activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
parent24a8ae4e08fcd15a8c3792990d1d0981d004d339 (diff)
downloadrails-4f72feb84c25b54f66c7192c788b7fd965f2d493.tar.gz
rails-4f72feb84c25b54f66c7192c788b7fd965f2d493.tar.bz2
rails-4f72feb84c25b54f66c7192c788b7fd965f2d493.zip
Move the transaction counter to the connection object rather than maintaining it on the current Thread.
Signed-off-by: Michael Koziarski <michael@koziarski.com> [#533 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index f48b107a2a..47dbf5a5f3 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -118,6 +118,19 @@ module ActiveRecord
@connection
end
+ def open_transactions
+ @open_transactions ||= 0
+ end
+
+ def increment_open_transactions
+ @open_transactions ||= 0
+ @open_transactions += 1
+ end
+
+ def decrement_open_transactions
+ @open_transactions -= 1
+ end
+
def log_info(sql, name, runtime)
if @logger && @logger.debug?
name = "#{name.nil? ? "SQL" : name} (#{sprintf("%f", runtime)})"