pub struct SqliteTransaction<'a> { /* private fields */ }Expand description
A SQLite transaction backed by raw BEGIN/COMMIT/ROLLBACK statements.
Holds a guard on the connection-level transaction mutex so that no other
async task can start a concurrent BEGIN on the same SqliteConnection.
When dropped without an explicit commit or rollback, the transaction
attempts a best-effort ROLLBACK via a background task.
§ROLLBACK limitation
Limbo 0.0.22 does not support ROLLBACK (bail_parse_error!("ROLLBACK not supported yet")). Calling rollback()
returns Err(OxiSqlError::Other("ROLLBACK is not supported by the limbo 0.0.22 engine …")) rather than propagating a raw parse error.
The Drop impl still fires a fire-and-forget background task so that any
future limbo release that adds ROLLBACK support will clean up implicitly.
Trait Implementations§
Source§impl<'a> Drop for SqliteTransaction<'a>
impl<'a> Drop for SqliteTransaction<'a>
Source§impl<'a> Transaction for SqliteTransaction<'a>
impl<'a> Transaction for SqliteTransaction<'a>
Source§fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [&'life3 dyn ToSqlValue],
) -> Pin<Box<dyn Future<Output = Result<u64, OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [&'life3 dyn ToSqlValue],
) -> Pin<Box<dyn Future<Output = Result<u64, OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Execute a DML/DDL statement within the transaction.
Source§fn query<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [&'life3 dyn ToSqlValue],
) -> Pin<Box<dyn Future<Output = Result<Vec<Row>, OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn query<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [&'life3 dyn ToSqlValue],
) -> Pin<Box<dyn Future<Output = Result<Vec<Row>, OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Execute a
SELECT statement within the transaction.Source§fn commit<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn commit<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
Commit all changes made within this transaction.
Source§fn rollback<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn rollback<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
Roll back all changes made within this transaction.
Source§fn savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Create a named savepoint within the transaction. Read more
Source§fn release_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn release_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Release (discard) a named savepoint. Read more
Source§fn rollback_to_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn rollback_to_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), OxiSqlError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Roll back the transaction to the named savepoint, undoing all changes
made after the savepoint was created without ending the transaction. Read more
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SqliteTransaction<'a>
impl<'a> !UnwindSafe for SqliteTransaction<'a>
impl<'a> Freeze for SqliteTransaction<'a>
impl<'a> Send for SqliteTransaction<'a>
impl<'a> Sync for SqliteTransaction<'a>
impl<'a> Unpin for SqliteTransaction<'a>
impl<'a> UnsafeUnpin for SqliteTransaction<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more