Skip to content

Commit 2d7171d

Browse files
committed
Make #rollback_db_transaction smarter.
1 parent 1935454 commit 2d7171d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
* 3.1.1 *
33

4+
* Make #rollback_db_transaction smarter.
5+
46
* Provide a method to override for the quoted string prefix. Not a config because trumping this method will
57
have drastically bad results. Fixes #124
68

lib/active_record/connection_adapters/sqlserver/database_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def commit_db_transaction
5454
end
5555

5656
def rollback_db_transaction
57-
do_execute "ROLLBACK TRANSACTION" rescue nil
57+
do_execute "IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION"
5858
end
5959

6060
def create_savepoint

0 commit comments

Comments
 (0)