diesel::connection

Struct AnsiTransactionManager

source
pub struct AnsiTransactionManager { /* private fields */ }
Expand description

An implementation of TransactionManager which can be used for backends which use ANSI standard syntax for savepoints such as SQLite and PostgreSQL.

Implementations§

source§

impl AnsiTransactionManager

source

pub fn begin_transaction_sql<Conn>( conn: &mut Conn, sql: &str, ) -> QueryResult<()>
where Conn: Connection<TransactionManager = Self>,

Begin a transaction with custom SQL

This is used by connections to implement more complex transaction APIs to set things such as isolation levels. Returns an error if already inside of a transaction.

Trait Implementations§

source§

impl Debug for AnsiTransactionManager

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for AnsiTransactionManager

source§

fn default() -> AnsiTransactionManager

Returns the “default value” for a type. Read more
source§

impl<Conn> TransactionManager<Conn> for AnsiTransactionManager
where Conn: Connection<TransactionManager = Self>,

source§

fn commit_transaction(conn: &mut Conn) -> QueryResult<()>

If the transaction fails to commit due to a SerializationFailure or a ReadOnlyTransaction a rollback will be attempted. If the rollback succeeds, the original error will be returned, otherwise the error generated by the rollback will be returned. In the second case the connection will be considered broken as it contains a uncommitted unabortable open transaction.

source§

type TransactionStateData = AnsiTransactionManager

Data stored as part of the connection implementation to track the current transaction state of a connection
source§

fn begin_transaction(conn: &mut Conn) -> QueryResult<()>

Begin a new transaction or savepoint Read more
source§

fn rollback_transaction(conn: &mut Conn) -> QueryResult<()>

Rollback the inner-most transaction or savepoint Read more
source§

fn transaction_manager_status_mut( conn: &mut Conn, ) -> &mut TransactionManagerStatus

Fetch the current transaction status as mutable Read more
source§

fn transaction<F, R, E>(conn: &mut Conn, callback: F) -> Result<R, E>
where F: FnOnce(&mut Conn) -> Result<R, E>, E: From<Error>,

Executes the given function inside of a database transaction Read more
source§

fn is_broken_transaction_manager(conn: &mut Conn) -> bool

This methods checks if the connection manager is considered to be broken by connection pool implementations Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoSql for T

source§

fn into_sql<T>(self) -> AsExprOf<Self, T>

Convert self to an expression for Diesel’s query builder. Read more
source§

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T>
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.