-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Savepoint queries should be internally executed so that they don't cl…
…ear the query cache
- Loading branch information
1 parent
ca76dc0
commit 90604da
Showing
3 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/active_record/connection_adapters/sqlserver/savepoints.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module ActiveRecord | ||
module ConnectionAdapters | ||
module SQLServer | ||
module Savepoints | ||
def current_savepoint_name | ||
current_transaction.savepoint_name | ||
end | ||
|
||
def create_savepoint(name = current_savepoint_name) | ||
internal_execute("SAVE TRANSACTION #{name}", "TRANSACTION") | ||
end | ||
|
||
def exec_rollback_to_savepoint(name = current_savepoint_name) | ||
internal_execute("ROLLBACK TRANSACTION #{name}", "TRANSACTION") | ||
end | ||
|
||
def release_savepoint(_name) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters