Guest User

Untitled

a guest
Feb 19th, 2018
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. From c5d18f6308d6980238caee2aea97df7894de4533 Mon Sep 17 00:00:00 2001
  2. From: Nick Sieger <nick@nicksieger.com>
  3. Date: Thu, 4 Sep 2008 15:35:55 +0200
  4. Subject: [PATCH] Remove flawed execute("ROLLBACK") approach; #reset! defaults to nothing
  5.  
  6. Will need community help to fill out what #reset! should do for each adapter
  7. ---
  8. .../connection_adapters/abstract_adapter.rb | 4 +---
  9. .../connection_adapters/mysql_adapter.rb | 2 --
  10. 2 files changed, 1 insertions(+), 5 deletions(-)
  11.  
  12. diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  13. index ad6e217..14dde57 100755
  14. --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  15. +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  16. @@ -112,9 +112,7 @@ module ActiveRecord
  17. # ROLLBACK and swallows any exceptions which is probably not enough to
  18. # ensure the connection is clean.
  19. def reset!
  20. - silence_stderr do # postgres prints on stderr when you do this w/o a txn
  21. - execute "ROLLBACK" rescue nil
  22. - end
  23. + # this should be overridden by concrete adapters
  24. end
  25.  
  26. # Returns true if its safe to reload the connection between requests for development mode.
  27. diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  28. index 14c76ac..f1d1369 100644
  29. --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  30. +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  31. @@ -286,8 +286,6 @@ module ActiveRecord
  32. # reset the connection is to change the user to the same user.
  33. @connection.change_user(@config[:username], @config[:password], @config[:database])
  34. configure_connection
  35. - else
  36. - super
  37. end
  38. end
  39.  
  40. --
  41. 1.5.6
Add Comment
Please, Sign In to add comment