pub struct Transaction<'a> { /* private fields */ }
Implementations§
Source§impl Transaction<'_>
impl Transaction<'_>
Sourcepub fn rollback(self) -> Result<()>
pub fn rollback(self) -> Result<()>
Will consume and rollback transaction. You also can rely on Drop
implementation but it
will swallow errors.
Sourcepub fn set_local_infile_handler(&mut self, handler: Option<LocalInfileHandler>)
pub fn set_local_infile_handler(&mut self, handler: Option<LocalInfileHandler>)
A way to override local infile handler for this transaction. Destructor of transaction will restore original handler.
Sourcepub fn affected_rows(&self) -> u64
pub fn affected_rows(&self) -> u64
Returns the number of affected rows, reported by the server.
Sourcepub fn last_insert_id(&self) -> Option<u64>
pub fn last_insert_id(&self) -> Option<u64>
Returns the last insert id of the last query, if any.
Trait Implementations§
Source§impl<'a> Debug for Transaction<'a>
impl<'a> Debug for Transaction<'a>
Source§impl<'a> Queryable for Transaction<'a>
impl<'a> Queryable for Transaction<'a>
Source§fn query_iter<T: AsRef<str>>(
&mut self,
query: T,
) -> Result<QueryResult<'_, '_, '_, Text>>
fn query_iter<T: AsRef<str>>( &mut self, query: T, ) -> Result<QueryResult<'_, '_, '_, Text>>
Performs text query.
Source§fn prep<T: AsRef<str>>(&mut self, query: T) -> Result<Statement>
fn prep<T: AsRef<str>>(&mut self, query: T) -> Result<Statement>
Prepares the given
query
as a prepared statement.Source§fn close(&mut self, stmt: Statement) -> Result<()>
fn close(&mut self, stmt: Statement) -> Result<()>
This function will close the given statement on the server side.
Source§fn exec_iter<S, P>(
&mut self,
stmt: S,
params: P,
) -> Result<QueryResult<'_, '_, '_, Binary>>
fn exec_iter<S, P>( &mut self, stmt: S, params: P, ) -> Result<QueryResult<'_, '_, '_, Binary>>
Executes the given
stmt
with the given params
.Source§fn query<T, Q>(&mut self, query: Q) -> Result<Vec<T>>
fn query<T, Q>(&mut self, query: Q) -> Result<Vec<T>>
Performs text query and collects the first result set.
Source§fn query_opt<T, Q>(
&mut self,
query: Q,
) -> Result<Vec<StdResult<T, FromRowError>>>
fn query_opt<T, Q>( &mut self, query: Q, ) -> Result<Vec<StdResult<T, FromRowError>>>
Same as
Queryable::query
but useful when you not sure what your schema is.Source§fn query_first<T, Q>(&mut self, query: Q) -> Result<Option<T>>
fn query_first<T, Q>(&mut self, query: Q) -> Result<Option<T>>
Performs text query and returns the first row of the first result set.
Source§fn query_first_opt<T, Q>(
&mut self,
query: Q,
) -> Result<Option<StdResult<T, FromRowError>>>
fn query_first_opt<T, Q>( &mut self, query: Q, ) -> Result<Option<StdResult<T, FromRowError>>>
Same as
Queryable::query_first
but useful when you not sure what your schema is.Source§fn query_map<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>>
fn query_map<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>>
Performs text query and maps each row of the first result set.
Source§fn query_map_opt<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>>
fn query_map_opt<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>>
Same as
Queryable::query_map
but useful when you not sure what your schema is.Source§fn query_fold<T, F, Q, U>(&mut self, query: Q, init: U, f: F) -> Result<U>
fn query_fold<T, F, Q, U>(&mut self, query: Q, init: U, f: F) -> Result<U>
Performs text query and folds the first result set to a single value.
Source§fn query_fold_opt<T, F, Q, U>(&mut self, query: Q, init: U, f: F) -> Result<U>
fn query_fold_opt<T, F, Q, U>(&mut self, query: Q, init: U, f: F) -> Result<U>
Same as
Queryable::query_fold
but useful when you not sure what your schema is.Source§fn query_drop<Q>(&mut self, query: Q) -> Result<()>
fn query_drop<Q>(&mut self, query: Q) -> Result<()>
Performs text query and drops the query result.
Source§fn exec_batch<S, P, I>(&mut self, stmt: S, params: I) -> Result<()>
fn exec_batch<S, P, I>(&mut self, stmt: S, params: I) -> Result<()>
Prepares the given statement, and executes it with each item in the given params iterator.
Source§fn exec<T, S, P>(&mut self, stmt: S, params: P) -> Result<Vec<T>>
fn exec<T, S, P>(&mut self, stmt: S, params: P) -> Result<Vec<T>>
Executes the given
stmt
and collects the first result set.Source§fn exec_opt<T, S, P>(
&mut self,
stmt: S,
params: P,
) -> Result<Vec<StdResult<T, FromRowError>>>
fn exec_opt<T, S, P>( &mut self, stmt: S, params: P, ) -> Result<Vec<StdResult<T, FromRowError>>>
Same as
Queryable::exec
but useful when you not sure what your schema is.Source§fn exec_first<T, S, P>(&mut self, stmt: S, params: P) -> Result<Option<T>>
fn exec_first<T, S, P>(&mut self, stmt: S, params: P) -> Result<Option<T>>
Executes the given
stmt
and returns the first row of the first result set.Source§fn exec_first_opt<T, S, P>(
&mut self,
stmt: S,
params: P,
) -> Result<Option<StdResult<T, FromRowError>>>
fn exec_first_opt<T, S, P>( &mut self, stmt: S, params: P, ) -> Result<Option<StdResult<T, FromRowError>>>
Same as
Queryable::exec_first
but useful when you not sure what your schema is.Source§fn exec_map<T, S, P, F, U>(
&mut self,
stmt: S,
params: P,
f: F,
) -> Result<Vec<U>>
fn exec_map<T, S, P, F, U>( &mut self, stmt: S, params: P, f: F, ) -> Result<Vec<U>>
Executes the given
stmt
and maps each row of the first result set.Source§fn exec_map_opt<T, S, P, F, U>(
&mut self,
stmt: S,
params: P,
f: F,
) -> Result<Vec<U>>
fn exec_map_opt<T, S, P, F, U>( &mut self, stmt: S, params: P, f: F, ) -> Result<Vec<U>>
Same as
Queryable::exec_map
but useful when you not sure what your schema is.Source§fn exec_fold<T, S, P, U, F>(
&mut self,
stmt: S,
params: P,
init: U,
f: F,
) -> Result<U>
fn exec_fold<T, S, P, U, F>( &mut self, stmt: S, params: P, init: U, f: F, ) -> Result<U>
Executes the given
stmt
and folds the first result set to a single value.Source§fn exec_fold_opt<T, S, P, U, F>(
&mut self,
stmt: S,
params: P,
init: U,
f: F,
) -> Result<U>
fn exec_fold_opt<T, S, P, U, F>( &mut self, stmt: S, params: P, init: U, f: F, ) -> Result<U>
Same as
Queryable::exec_fold
but useful when you not sure what your schema is.Auto Trait Implementations§
impl<'a> Freeze for Transaction<'a>
impl<'a> RefUnwindSafe for Transaction<'a>
impl<'a> Send for Transaction<'a>
impl<'a> Sync for Transaction<'a>
impl<'a> Unpin for Transaction<'a>
impl<'a> !UnwindSafe for Transaction<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more