Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix driver transaction behavior #84

Merged
merged 2 commits into from
Aug 17, 2023
Merged

Fix driver transaction behavior #84

merged 2 commits into from
Aug 17, 2023

Conversation

proullon
Copy link
Owner

@proullon proullon commented Aug 17, 2023

Context

Upon call to Conn.BeginTx(), Go driver continue to use underlying conn for QueryContext and ExecContext, expecting them to run in previously called transaction.

Fix

As sql.Conn is single threaded, Conn object keeps tracks of current open Tx. If no Tx is opened upon call to QueryContext or ExecContext, creates and autocommit transaction.

Tests

  • TestTransaction
  • TestTransactionRollback

Closes #81

@proullon proullon marked this pull request as ready for review August 17, 2023 16:55
@proullon proullon merged commit a7e15a6 into master Aug 17, 2023
1 check passed
@proullon proullon deleted the fix/81 branch August 17, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic on unlock of unlocked mutex
1 participant