[][src]Struct sql_support::conn_ext::UncheckedTransaction

pub struct UncheckedTransaction<'conn> {
    pub conn: &'conn Connection,
    pub started_at: Instant,
    pub finished: bool,
}

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 Connectionstarted_at: Instantfinished: bool

Implementations

impl<'conn> UncheckedTransaction<'conn>[src]

pub fn new(
    conn: &'conn Connection,
    behavior: TransactionBehavior
) -> SqlResult<Self>
[src]

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]

impl<'conn> Deref for UncheckedTransaction<'conn>[src]

type Target = Connection

The resulting type after dereferencing.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.