[−][src]Struct sql_support::UncheckedTransaction
rusqlite, in an attempt to save us from ourselves, needs a mutable ref to a connection to start a transaction. That is a bit of a PITA in some cases, so we offer this as an alternative - but the responsibility of ensuring there are no concurrent transactions is on our head.
This is very similar to the rusqlite Transaction
- it doesn't prevent
against nested transactions but does allow you to use an immutable
Connection
.
Fields
conn: &'conn Connection
started_at: Instant
finished: bool
Implementations
impl<'conn> UncheckedTransaction<'conn>
[src]
pub fn new(
conn: &'conn Connection,
behavior: TransactionBehavior
) -> SqlResult<Self>
[src]
conn: &'conn Connection,
behavior: TransactionBehavior
) -> SqlResult<Self>
Begin a new unchecked transaction. Cannot be nested, but this is not
enforced by Rust (hence 'unchecked') - however, it is enforced by
SQLite; use a rusqlite savepoint
for nested transactions.
pub fn commit(self) -> SqlResult<()>
[src]
Consumes and commits an unchecked transaction.
pub fn rollback(self) -> SqlResult<()>
[src]
Consumes and rolls back an unchecked transaction.
fn rollback_(&mut self) -> SqlResult<()>
[src]
fn finish_(&mut self) -> SqlResult<()>
[src]
Trait Implementations
impl<'conn> ConnExt for UncheckedTransaction<'conn>
[src]
fn conn(&self) -> &Connection
[src]
fn set_pragma<T>(&self, pragma_name: &str, pragma_value: T) -> SqlResult<&Self> where
T: ToSql,
Self: Sized,
[src]
T: ToSql,
Self: Sized,
fn prepare_maybe_cached<'conn>(
&'conn self,
sql: &str,
cache: bool
) -> SqlResult<MaybeCached<'conn>>
[src]
&'conn self,
sql: &str,
cache: bool
) -> SqlResult<MaybeCached<'conn>>
fn execute_all(&self, stmts: &[&str]) -> SqlResult<()>
[src]
fn execute_cached<P>(&self, sql: &str, params: P) -> SqlResult<usize> where
P: IntoIterator,
P::Item: ToSql,
[src]
P: IntoIterator,
P::Item: ToSql,
fn execute_named_cached(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)]
) -> SqlResult<usize>
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)]
) -> SqlResult<usize>
fn query_one<T: FromSql>(&self, sql: &str) -> SqlResult<T>
[src]
fn try_query_one<T: FromSql>(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
cache: bool
) -> SqlResult<Option<T>> where
Self: Sized,
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
cache: bool
) -> SqlResult<Option<T>> where
Self: Sized,
fn query_row_and_then_named<T, E, F>(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F,
cache: bool
) -> Result<T, E> where
Self: Sized,
E: From<Error>,
F: FnOnce(&Row<'_>) -> Result<T, E>,
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F,
cache: bool
) -> Result<T, E> where
Self: Sized,
E: From<Error>,
F: FnOnce(&Row<'_>) -> Result<T, E>,
fn query_rows_and_then_named<T, E, F>(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Vec<T>, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Vec<T>, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
fn query_rows_and_then_named_cached<T, E, F>(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Vec<T>, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Vec<T>, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
fn query_rows_into<Coll, T, E, F>(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Coll, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
Coll: FromIterator<T>,
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Coll, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
Coll: FromIterator<T>,
fn query_rows_into_cached<Coll, T, E, F>(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Coll, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
Coll: FromIterator<T>,
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F
) -> Result<Coll, E> where
Self: Sized,
E: From<Error>,
F: FnMut(&Row<'_>) -> Result<T, E>,
Coll: FromIterator<T>,
fn try_query_row<T, E, F>(
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F,
cache: bool
) -> Result<Option<T>, E> where
Self: Sized,
E: From<Error>,
F: FnOnce(&Row<'_>) -> Result<T, E>,
[src]
&self,
sql: &str,
params: &[(&str, &dyn ToSql)],
mapper: F,
cache: bool
) -> Result<Option<T>, E> where
Self: Sized,
E: From<Error>,
F: FnOnce(&Row<'_>) -> Result<T, E>,
fn unchecked_transaction(&self) -> SqlResult<UncheckedTransaction<'_>>
[src]
fn unchecked_transaction_imm(&self) -> SqlResult<UncheckedTransaction<'_>>
[src]
impl<'conn> Deref for UncheckedTransaction<'conn>
[src]
impl<'conn> Drop for UncheckedTransaction<'conn>
[src]
Auto Trait Implementations
impl<'conn> !RefUnwindSafe for UncheckedTransaction<'conn>
impl<'conn> !Send for UncheckedTransaction<'conn>
impl<'conn> !Sync for UncheckedTransaction<'conn>
impl<'conn> Unpin for UncheckedTransaction<'conn>
impl<'conn> !UnwindSafe for UncheckedTransaction<'conn>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,