Allow setting default connection transaction behavior#1532
Merged
gwenn merged 3 commits intorusqlite:masterfrom Jul 19, 2024
Merged
Allow setting default connection transaction behavior#1532gwenn merged 3 commits intorusqlite:masterfrom
gwenn merged 3 commits intorusqlite:masterfrom
Conversation
gwenn
reviewed
Jul 17, 2024
Collaborator
|
At least, we should document that this flag / field is ignored by manual / direct transactions: let mut conn = Connection::open_in_memory()?;
conn.set_transaction_behavior(TransactionBehavior::Immediate);
conn.execute_batch("BEGIN")?; // deferred
... |
Contributor
Author
|
Thanks for the very quick review @gwenn and thanks for being open to this new feature. I have refactored the code based on your comments and add an example so it is consistent with the rest of the code. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1532 +/- ##
==========================================
- Coverage 85.23% 85.20% -0.03%
==========================================
Files 54 54
Lines 10469 10476 +7
==========================================
+ Hits 8923 8926 +3
- Misses 1546 1550 +4 ☔ View full report in Codecov by Sentry. |
Collaborator
|
Thanks. |
cljoly
added a commit
to cljoly/rusqlite_migration
that referenced
this pull request
Jul 22, 2024
Changelog at https://github.com/rusqlite/rusqlite/releases/tag/v0.32.0 Potential concern: * rusqlite/rusqlite#1532: does this mean that default transaction behavior can interfer with the migrations?
4 tasks
cljoly
added a commit
to cljoly/rusqlite_migration
that referenced
this pull request
Aug 20, 2024
Changelog at https://github.com/rusqlite/rusqlite/releases/tag/v0.32.0 Concerns: * rusqlite/rusqlite#1532: does this mean that default transaction behavior can interfer with the migrations?
cljoly
added a commit
to cljoly/rusqlite_migration
that referenced
this pull request
Sep 23, 2024
Changelog at https://github.com/rusqlite/rusqlite/releases/tag/v0.32.0 Concerns: * rusqlite/rusqlite#1532: does this mean that default transaction behavior can interfer with the migrations?
cljoly
added a commit
to cljoly/rusqlite_migration
that referenced
this pull request
Sep 23, 2024
Changelog at https://github.com/rusqlite/rusqlite/releases/tag/v0.32.0 Concerns: * rusqlite/rusqlite#1532: does this mean that default transaction behavior can interfer with the migrations?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
It would be nice if a per connection default
transaction_behaviorcould be set instead of having to usetransaction_with_behavioreverywhere.Then, for example:
conn.set_transaction_behavior(TransactionBehavior::Immediate)conn.set_transaction_behavior(TransactionBehavior::Deferred)This PR adds this behavior with the default value remaining unchanged as
TransactionBehavior::Deferred.