Skip to content

Commit

Permalink
Fix materialized transaction queries (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan authored Oct 9, 2023
1 parent b88b140 commit d195598
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,28 @@ def exec_update(sql, name, binds)
end

def begin_db_transaction
execute "BEGIN TRANSACTION", "TRANSACTION"
internal_execute("BEGIN TRANSACTION", "TRANSACTION", allow_retry: true, materialize_transactions: false)
end

def transaction_isolation_levels
super.merge snapshot: "SNAPSHOT"
end

def begin_isolated_db_transaction(isolation)
set_transaction_isolation_level transaction_isolation_levels.fetch(isolation)
set_transaction_isolation_level(transaction_isolation_levels.fetch(isolation))
begin_db_transaction
end

def set_transaction_isolation_level(isolation_level)
execute "SET TRANSACTION ISOLATION LEVEL #{isolation_level}", "TRANSACTION"
internal_execute("SET TRANSACTION ISOLATION LEVEL #{isolation_level}", "TRANSACTION", allow_retry: true, materialize_transactions: false)
end

def commit_db_transaction
execute "COMMIT TRANSACTION", "TRANSACTION"
internal_execute("COMMIT TRANSACTION", "TRANSACTION", allow_retry: false, materialize_transactions: true)
end

def exec_rollback_db_transaction
execute "IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION", "TRANSACTION"
internal_execute("IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION", "TRANSACTION", allow_retry: false, materialize_transactions: true)
end

def case_sensitive_comparison(attribute, value)
Expand Down

0 comments on commit d195598

Please sign in to comment.