Struct postgres::transaction::Transaction
[−]
[src]
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]
fn prepare(&self, query: &str) -> Result<Statement<'conn>>[src]
Like Connection::prepare.
fn prepare_cached(&self, query: &str) -> Result<Statement<'conn>>[src]
Like Connection::prepare_cached.
Note
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>[src]
Like Connection::execute.
fn query<'a>(&'a self, query: &str, params: &[&ToSql]) -> Result<Rows>[src]
Like Connection::query.
fn batch_execute(&self, query: &str) -> Result<()>[src]
Like Connection::batch_execute.
fn transaction<'a>(&'a self) -> Result<Transaction<'a>>[src]
Like Connection::transaction, but creates a nested transaction via
a savepoint.
Panics
Panics if there is an active nested transaction.
fn savepoint<'a>(&'a self, name: &str) -> Result<Transaction<'a>>[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.
fn connection(&self) -> &'conn Connection[src]
Returns a reference to the Transaction's Connection.
fn is_active(&self) -> bool[src]
Like Connection::is_active.
fn set_config(&self, config: &Config) -> Result<()>[src]
Alters the configuration of the active transaction.
fn will_commit(&self) -> bool[src]
Determines if the transaction is currently set to commit or roll back.
fn set_commit(&self)[src]
Sets the transaction to commit at its completion.
fn set_rollback(&self)[src]
Sets the transaction to roll back at its completion.
fn commit(self) -> Result<()>[src]
A convenience method which consumes and commits a transaction.
fn finish(self) -> Result<()>[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<'conn> Drop for Transaction<'conn>[src]
impl<'a> GenericConnection for Transaction<'a>[src]
fn execute(&self, query: &str, params: &[&ToSql]) -> Result<u64>[src]
Like Connection::execute.
fn query<'b>(&'b self, query: &str, params: &[&ToSql]) -> Result<Rows>[src]
Like Connection::query.
fn prepare<'b>(&'b self, query: &str) -> Result<Statement<'b>>[src]
Like Connection::prepare.
fn prepare_cached<'b>(&'b self, query: &str) -> Result<Statement<'b>>[src]
Like Connection::prepare_cached.
fn transaction<'b>(&'b self) -> Result<Transaction<'b>>[src]
Like Connection::transaction.
fn batch_execute(&self, query: &str) -> Result<()>[src]
Like Connection::batch_execute.
fn is_active(&self) -> bool[src]
Like Connection::is_active.