[][src]Struct c3p0_pool_pg::r2d2::postgres::transaction::Transaction

pub struct Transaction<'conn> { /* fields omitted */ }

A transaction on a database connection.

The transaction will roll back by default.

Methods

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

pub fn prepare(&self, query: &str) -> Result<Statement<'conn>, Error>[src]

Like Connection::prepare.

pub fn prepare_cached(&self, query: &str) -> Result<Statement<'conn>, Error>[src]

Like Connection::prepare_cached.

Note

The statement will be cached for the duration of the connection, not just the duration of this transaction.

pub fn execute(&self, query: &str, params: &[&dyn ToSql]) -> Result<u64, Error>[src]

Like Connection::execute.

pub fn query(
    &'a self,
    query: &str,
    params: &[&dyn ToSql]
) -> Result<Rows, Error>
[src]

Like Connection::query.

pub fn batch_execute(&self, query: &str) -> Result<(), Error>[src]

Like Connection::batch_execute.

pub fn transaction(&'a self) -> Result<Transaction<'a>, Error>[src]

Like Connection::transaction, but creates a nested transaction via a savepoint.

Panics

Panics if there is an active nested transaction.

pub fn savepoint(&'a self, name: &str) -> Result<Transaction<'a>, Error>[src]

Like Connection::transaction, but creates a nested transaction via a savepoint with the specified name.

Panics

Panics if there is an active nested transaction.

pub fn connection(&self) -> &'conn Connection[src]

Returns a reference to the Transaction's Connection.

pub fn is_active(&self) -> bool[src]

Like Connection::is_active.

pub fn set_config(&self, config: &Config) -> Result<(), Error>[src]

Alters the configuration of the active transaction.

pub fn will_commit(&self) -> bool[src]

Determines if the transaction is currently set to commit or roll back.

pub fn set_commit(&self)[src]

Sets the transaction to commit at its completion.

pub fn set_rollback(&self)[src]

Sets the transaction to roll back at its completion.

pub fn commit(self) -> Result<(), Error>[src]

A convenience method which consumes and commits a transaction.

pub fn finish(self) -> Result<(), Error>[src]

Consumes the transaction, commiting or rolling it back as appropriate.

Functionally equivalent to the Drop implementation of Transaction except that it returns any error to the caller.

Trait Implementations

impl<'a> Debug for Transaction<'a>[src]

impl<'a> GenericConnection for Transaction<'a>[src]

impl<'conn> Drop for Transaction<'conn>[src]

Auto Trait Implementations

impl<'conn> Unpin for Transaction<'conn>

impl<'conn> !Send for Transaction<'conn>

impl<'conn> !Sync for Transaction<'conn>

impl<'conn> !RefUnwindSafe for Transaction<'conn>

impl<'conn> !UnwindSafe for Transaction<'conn>

Blanket Implementations

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self