Struct mysql_async::Transaction[][src]

pub struct Transaction<'a>(_);

This struct represents MySql transaction.

Transaction is just a sugar for START TRANSACTION, ROLLBACK and COMMIT queries, so please note, that it is easy to mess things up calling this queries manually.

You should alwasy call either commit or rollback, otherwise transaction will be rolled back implicitly when corresponding connection is dropped or queried.

Implementations

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

pub async fn commit(self) -> Result<()>[src]

Performs COMMIT query.

pub async fn rollback(self) -> Result<()>[src]

Performs ROLLBACK query.

Methods from Deref<Target = Conn>

pub fn id(&self) -> u32[src]

Returns connection identifier.

pub fn last_insert_id(&self) -> Option<u64>[src]

Returns the ID generated by a query (usually INSERT) on a table with a column having the AUTO_INCREMENT attribute. Returns None if there was no previous query on the connection or if the query did not update an AUTO_INCREMENT value.

pub fn affected_rows(&self) -> u64[src]

Returns the number of rows affected by the last INSERT, UPDATE, REPLACE or DELETE query.

pub fn info(&self) -> Cow<'_, str>[src]

Text information, as reported by the server in the last OK packet, or an empty string.

pub fn get_warnings(&self) -> u16[src]

Number of warnings, as reported by the server in the last OK packet, or 0.

pub fn server_version(&self) -> (u16, u16, u16)[src]

Returns server version.

pub fn opts(&self) -> &Opts[src]

Returns connection options.

Trait Implementations

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

impl Deref for Transaction<'_>[src]

type Target = Conn

The resulting type after dereferencing.

impl Drop for Transaction<'_>[src]

impl Queryable for Transaction<'_>[src]

impl<'a, 't> ToConnection<'a, 't> for &'a mut Transaction<'t>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Transaction<'a>[src]

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

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

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

impl<'a> !UnwindSafe for Transaction<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,