Struct mysql_async::Transaction [−][src]
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]
impl Drop for Transaction<'_>
[src]
impl Queryable for Transaction<'_>
[src]
fn ping(&mut self) -> BoxFuture<'_, ()>ⓘ
[src]
fn query_iter<'a, Q>(
&'a mut self,
query: Q
) -> BoxFuture<'a, QueryResult<'a, 'static, TextProtocol>>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
[src]
&'a mut self,
query: Q
) -> BoxFuture<'a, QueryResult<'a, 'static, TextProtocol>>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
fn prep<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Statement>ⓘ where
Q: AsRef<str> + Sync + Send + 'a,
[src]
Q: AsRef<str> + Sync + Send + 'a,
fn close(&mut self, stmt: Statement) -> BoxFuture<'_, ()>ⓘ
[src]
fn exec_iter<'a: 's, 's, Q, P>(
&'a mut self,
stmt: Q,
params: P
) -> BoxFuture<'s, QueryResult<'a, 'static, BinaryProtocol>>ⓘ where
Q: StatementLike + 'a,
P: Into<Params>,
[src]
&'a mut self,
stmt: Q,
params: P
) -> BoxFuture<'s, QueryResult<'a, 'static, BinaryProtocol>>ⓘ where
Q: StatementLike + 'a,
P: Into<Params>,
fn query<'a, T, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Vec<T>>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
[src]
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
fn query_first<'a, T, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Option<T>>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
[src]
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
fn query_map<'a, T, F, Q, U>(
&'a mut self,
query: Q,
f: F
) -> BoxFuture<'a, Vec<U>>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
F: FnMut(T) -> U + Send + 'a,
U: Send,
[src]
&'a mut self,
query: Q,
f: F
) -> BoxFuture<'a, Vec<U>>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
F: FnMut(T) -> U + Send + 'a,
U: Send,
fn query_fold<'a, T, F, Q, U>(
&'a mut self,
query: Q,
init: U,
f: F
) -> BoxFuture<'a, U>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
F: FnMut(U, T) -> U + Send + 'a,
U: Send + 'a,
[src]
&'a mut self,
query: Q,
init: U,
f: F
) -> BoxFuture<'a, U>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
T: FromRow + Send + 'static,
F: FnMut(U, T) -> U + Send + 'a,
U: Send + 'a,
fn query_drop<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, ()>ⓘ where
Q: AsRef<str> + Send + Sync + 'a,
[src]
Q: AsRef<str> + Send + Sync + 'a,
fn exec_batch<'a: 'b, 'b, S, P, I>(
&'a mut self,
stmt: S,
params_iter: I
) -> BoxFuture<'b, ()>ⓘ where
S: StatementLike + 'b,
I: IntoIterator<Item = P> + Send + 'b,
I::IntoIter: Send,
P: Into<Params> + Send,
[src]
&'a mut self,
stmt: S,
params_iter: I
) -> BoxFuture<'b, ()>ⓘ where
S: StatementLike + 'b,
I: IntoIterator<Item = P> + Send + 'b,
I::IntoIter: Send,
P: Into<Params> + Send,
fn exec<'a: 'b, 'b, T, S, P>(
&'a mut self,
stmt: S,
params: P
) -> BoxFuture<'b, Vec<T>>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
[src]
&'a mut self,
stmt: S,
params: P
) -> BoxFuture<'b, Vec<T>>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
fn exec_first<'a: 'b, 'b, T, S, P>(
&'a mut self,
stmt: S,
params: P
) -> BoxFuture<'b, Option<T>>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
[src]
&'a mut self,
stmt: S,
params: P
) -> BoxFuture<'b, Option<T>>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
fn exec_map<'a: 'b, 'b, T, S, P, U, F>(
&'a mut self,
stmt: S,
params: P,
f: F
) -> BoxFuture<'b, Vec<U>>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
F: FnMut(T) -> U + Send + 'a,
U: Send + 'a,
[src]
&'a mut self,
stmt: S,
params: P,
f: F
) -> BoxFuture<'b, Vec<U>>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
F: FnMut(T) -> U + Send + 'a,
U: Send + 'a,
fn exec_fold<'a: 'b, 'b, T, S, P, U, F>(
&'a mut self,
stmt: S,
params: P,
init: U,
f: F
) -> BoxFuture<'b, U>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
F: FnMut(U, T) -> U + Send + 'a,
U: Send + 'a,
[src]
&'a mut self,
stmt: S,
params: P,
init: U,
f: F
) -> BoxFuture<'b, U>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static,
F: FnMut(U, T) -> U + Send + 'a,
U: Send + 'a,
fn exec_drop<'a: 'b, 'b, S, P>(
&'a mut self,
stmt: S,
params: P
) -> BoxFuture<'b, ()>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
[src]
&'a mut self,
stmt: S,
params: P
) -> BoxFuture<'b, ()>ⓘ where
S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,