Skip to content

Instantly share code, notes, and snippets.

@nicksieger
Created September 4, 2008 13:37
Show Gist options
  • Save nicksieger/8772 to your computer and use it in GitHub Desktop.
Save nicksieger/8772 to your computer and use it in GitHub Desktop.
From c5d18f6308d6980238caee2aea97df7894de4533 Mon Sep 17 00:00:00 2001
From: Nick Sieger <[email protected]>
Date: Thu, 4 Sep 2008 15:35:55 +0200
Subject: [PATCH] Remove flawed execute("ROLLBACK") approach; #reset! defaults to nothing
Will need community help to fill out what #reset! should do for each adapter
---
.../connection_adapters/abstract_adapter.rb | 4 +---
.../connection_adapters/mysql_adapter.rb | 2 --
2 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index ad6e217..14dde57 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -112,9 +112,7 @@ module ActiveRecord
# ROLLBACK and swallows any exceptions which is probably not enough to
# ensure the connection is clean.
def reset!
- silence_stderr do # postgres prints on stderr when you do this w/o a txn
- execute "ROLLBACK" rescue nil
- end
+ # this should be overridden by concrete adapters
end
# Returns true if its safe to reload the connection between requests for development mode.
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 14c76ac..f1d1369 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -286,8 +286,6 @@ module ActiveRecord
# reset the connection is to change the user to the same user.
@connection.change_user(@config[:username], @config[:password], @config[:database])
configure_connection
- else
- super
end
end
--
1.5.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment