Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #12779 from dougbarth/dont_swallow_exceptions_duri…

…ng_transactional_statements_in_mysql

Don't swallow exceptions in transctional statements
  • Loading branch information...
commit 314e2cc05b6cad93b6e8a3414b2c0106174239be 2 parents 8c66623 + 2b0406c
@tenderlove tenderlove authored
View
8 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -320,27 +320,19 @@ def update_sql(sql, name = nil) #:nodoc:
def begin_db_transaction
execute "BEGIN"
- rescue
- # Transactions aren't supported
end
def begin_isolated_db_transaction(isolation)
execute "SET TRANSACTION ISOLATION LEVEL #{transaction_isolation_levels.fetch(isolation)}"
begin_db_transaction
- rescue
- # Transactions aren't supported
end
def commit_db_transaction #:nodoc:
execute "COMMIT"
- rescue
- # Transactions aren't supported
end
def rollback_db_transaction #:nodoc:
execute "ROLLBACK"
- rescue
- # Transactions aren't supported
end
# In the simple case, MySQL allows us to place JOINs directly into the UPDATE
View
2  activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -462,8 +462,6 @@ def exec_delete(sql, name, binds)
def begin_db_transaction #:nodoc:
exec_query "BEGIN"
- rescue Mysql::Error
- # Transactions aren't supported
end
private
View
5 activerecord/test/cases/adapters/mysql/connection_test.rb
@@ -40,6 +40,11 @@ def test_no_automatic_reconnection_after_timeout
@connection.update('set @@wait_timeout=1')
sleep 2
assert !@connection.active?
+
+ # Repair all fixture connections so other tests won't break.
+ @fixture_connections.each do |c|
+ c.verify!
+ end
end
def test_successful_reconnection_after_timeout_with_manual_reconnect
View
5 activerecord/test/cases/adapters/mysql2/connection_test.rb
@@ -18,6 +18,11 @@ def test_no_automatic_reconnection_after_timeout
@connection.update('set @@wait_timeout=1')
sleep 2
assert !@connection.active?
+
+ # Repair all fixture connections so other tests won't break.
+ @fixture_connections.each do |c|
+ c.verify!
+ end
end
def test_successful_reconnection_after_timeout_with_manual_reconnect
Please sign in to comment.
Something went wrong with that request. Please try again.