[−][src]Struct c3p0_pg::postgres::transaction::Transaction
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]
&'a self,
query: &str,
params: &[&dyn ToSql]
) -> Result<Rows, Error>
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]
fn execute(&self, query: &str, params: &[&dyn ToSql]) -> Result<u64, Error>
[src]
fn query(&'b self, query: &str, params: &[&dyn ToSql]) -> Result<Rows, Error>
[src]
fn prepare(&'b self, query: &str) -> Result<Statement<'b>, Error>
[src]
fn prepare_cached(&'b self, query: &str) -> Result<Statement<'b>, Error>
[src]
fn transaction(&'b self) -> Result<Transaction<'b>, Error>
[src]
fn batch_execute(&self, query: &str) -> Result<(), Error>
[src]
fn is_active(&self) -> bool
[src]
impl<'conn> Drop for Transaction<'conn>
[src]
Auto Trait Implementations
impl<'conn> !Sync for Transaction<'conn>
impl<'conn> !Send for Transaction<'conn>
impl<'conn> Unpin for Transaction<'conn>
impl<'conn> !RefUnwindSafe for Transaction<'conn>
impl<'conn> !UnwindSafe for Transaction<'conn>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self