Skip to content

Add context manager support for database connections #96

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AdrianAcala
Copy link

Implements enter and exit methods to enable using Connection objects as context managers. On clean exit, transactions are automatically committed. On exception, transactions are automatically rolled back. This provides sqlite3-compatible behavior and safer transaction handling.

Closes #95

Implements __enter__ and __exit__ methods to enable using Connection objects
as context managers. On clean exit, transactions are automatically committed.
On exception, transactions are automatically rolled back. This provides
sqlite3-compatible behavior and safer transaction handling.

Closes tursodatabase#95
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.

Automatic commit and rollback when connection used in with block
1 participant