pub struct PooledConnection<T: Driver, A: ConnectionAdapter<T>> { /* private fields */ }
Implementations§
Source§impl<T: Driver> PooledConnection<T, SyncConnectionAdapter<T>>
impl<T: Driver> PooledConnection<T, SyncConnectionAdapter<T>>
Sourcepub fn read_transaction_closure<F, R, E>(&mut self, closure: F) -> Result<R, E>
pub fn read_transaction_closure<F, R, E>(&mut self, closure: F) -> Result<R, E>
Perform a read operation with a stable scope.
This method uses an explicit transaction to ensure the reader does not take into account ongoing modifications of writers during the execution of the statements in the scope of the closure.
Use [Self::read
] if you want to have the default sqlite behavior, where each statement
gets their own transaction.
§Errors
Returns error if the closure failed or if the read transaction could not be initiated.
Sourcepub fn transaction_closure<F, R, E>(&mut self, closure: F) -> Result<R, E>
pub fn transaction_closure<F, R, E>(&mut self, closure: F) -> Result<R, E>
Create a transaction and run the given closure
in its scope.
If the closure returns an error the transaction is aborted, otherwise it is commited.
§Errors
Returns error if the closure failed or the transaction failed to commit.
Sourcepub fn transaction(&mut self) -> Result<Transaction<'_, T>, T::Error>
pub fn transaction(&mut self) -> Result<Transaction<'_, T>, T::Error>
Create a new transaction type that needs to be manually commited.
If the transaction is dropped without an explicit call to Transaction::rollback
or
Transaction::commit
, the transaction will be rolled back.
§Errors
Returns an error if the transaction could not be created.
Sourcepub fn read_transaction(&mut self) -> Result<ReadTransaction<'_, T>, T::Error>
pub fn read_transaction(&mut self) -> Result<ReadTransaction<'_, T>, T::Error>
Create a new read transaction type that needs to be manually commited.
If the transaction is dropped without an explicit call to
ReadTransaction::commit
, the transaction will be rolled back.
§Errors
Returns an error if the transaction could not be created.