Closed Alenar closed 3 weeks ago
3 files ±0 43 suites ±0 8m 35s :stopwatch: +8s 1 035 tests +6 1 035 :white_check_mark: +6 0 :zzz: ±0 0 :x: ±0 1 133 runs +6 1 133 :white_check_mark: +6 0 :zzz: ±0 0 :x: ±0
Results for commit 12576161. ± Comparison against base commit f5097f0a.
:recycle: This comment has been updated with latest results.
Content
This PR add a light layer to easily open, commit, and rollback SQLite transactions.
This is done by adding a
Transaction
struct tomithril-persistence
that:begin
(the constructor),commit
androllback
.commit
androllback
method move self, meaning that using either of them remove the transaction of the current scope: the compiler won't allow to use severalcommit
orrollback
on the same transaction.Drop
to automatically rollback the transaction when it goes out of scope if it was still active.Also a
begin_transaction
extension method is added to the sqlite transaction so they can be created without needing to import the new type.Pre-submit checklist
Comments
While this system make using SQLite transactions easier it should not be used on our main SQLite database until we implement a connection pool system instead of sharing a global connection. Else we would be at risk of opening a transaction when one was already opened leading to at minimum an error or at worst a crash.
Issue(s)
Closes #1741