Struct postgres::Transaction [] [src]

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

Represents a transaction on a database connection.

The transaction will roll back by default.

Methods

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

fn prepare(&self, query: &str) -> Result<Statement<'conn>>

Like Connection::prepare.

fn prepare_cached(&self, query: &str) -> Result<Statement<'conn>>

Like Connection::prepare_cached.

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

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

Like Connection::execute.

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

Like Connection::query.

fn batch_execute(&self, query: &str) -> Result<()>

Like Connection::batch_execute.

fn transaction<'a>(&'a self) -> Result<Transaction<'a>>

Like Connection::transaction.

Panics

Panics if there is an active nested transaction.

fn connection(&self) -> &'conn Connection

Returns a reference to the Transaction's Connection.

fn is_active(&self) -> bool

Like Connection::is_active.

fn will_commit(&self) -> bool

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

fn set_commit(&self)

Sets the transaction to commit at its completion.

fn set_rollback(&self)

Sets the transaction to roll back at its completion.

fn commit(self) -> Result<()>

A convenience method which consumes and commits a transaction.

fn finish(self) -> Result<()>

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]

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.

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

fn drop(&mut self)

A method called when the value goes out of scope. Read more

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

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

Like Connection::execute.

fn query<'b>(&'b self, query: &str, params: &[&ToSql]) -> Result<Rows<'b>>

Like Connection::query.

fn prepare<'b>(&'b self, query: &str) -> Result<Statement<'b>>

Like Connection::prepare.

fn prepare_cached<'b>(&'b self, query: &str) -> Result<Statement<'b>>

Like Connection::prepare_cached.

fn transaction<'b>(&'b self) -> Result<Transaction<'b>>

Like Connection::transaction.

fn batch_execute(&self, query: &str) -> Result<()>

Like Connection::batch_execute.

fn is_active(&self) -> bool

Like Connection::is_active.