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 batch_execute(&self, query: &str) -> Result<()>
Like Connection::batch_execute
.
fn transaction<'a>(&'a self) -> Result<Transaction<'a>>
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]
impl<'conn> Drop for Transaction<'conn>
[src]
impl<'a> GenericConnection for Transaction<'a>
[src]
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 execute(&self, query: &str, params: &[&ToSql]) -> Result<u64>
Like Connection::execute
.
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
.