Struct sqlx::Transaction [−][src]
pub struct Transaction<'c, DB> where
DB: Database, { /* fields omitted */ }
Expand description
An in-progress database transaction or savepoint.
A transaction starts with a call to Pool::begin
or Connection::begin
.
A transaction should end with a call to commit
or rollback
. If neither are called
before the transaction goes out-of-scope, rollback
is called. In other
words, rollback
is called on drop
if the transaction is still in-progress.
A savepoint is a special mark inside a transaction that allows all commands that are executed after it was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint.
Implementations
Trait Implementations
type Connection = &'t mut <Postgres as Database>::Connection
type Connection = &'t mut <Any as Database>::Connection
type Connection = &'t mut <MySql as Database>::Connection
type Connection = &'t mut <Sqlite as Database>::Connection
type Connection = &'t mut <Mssql as Database>::Connection
type Target = <DB as Database>::Connection
type Target = <DB as Database>::Connection
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Execute multiple queries and return the generated results as a stream from each query, in a stream. Read more
Execute the query and returns at most one row.
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, MySql> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, MySql> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, MySql> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, MySql> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
Prepare the SQL query, with parameter type information, to inspect the type information about its parameters and results. Read more
Execute the query and return the total number of rows affected.
Execute multiple queries and return the rows affected from each query, in a stream.
Execute the query and return the generated results as a stream.
Execute the query and return all the generated results, collected into a Vec
.
Execute the query and returns exactly one row.
Execute multiple queries and return the generated results as a stream from each query, in a stream. Read more
Execute the query and returns at most one row.
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Postgres> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Postgres> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Postgres> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Postgres> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
Prepare the SQL query, with parameter type information, to inspect the type information about its parameters and results. Read more
Execute the query and return the total number of rows affected.
Execute multiple queries and return the rows affected from each query, in a stream.
Execute the query and return the generated results as a stream.
Execute the query and return all the generated results, collected into a Vec
.
Execute the query and returns exactly one row.
Execute multiple queries and return the generated results as a stream from each query, in a stream. Read more
Execute the query and returns at most one row.
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Sqlite> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Sqlite> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Sqlite> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Sqlite> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
Prepare the SQL query, with parameter type information, to inspect the type information about its parameters and results. Read more
Execute the query and return the total number of rows affected.
Execute multiple queries and return the rows affected from each query, in a stream.
Execute the query and return the generated results as a stream.
Execute the query and return all the generated results, collected into a Vec
.
Execute the query and returns exactly one row.
Execute multiple queries and return the generated results as a stream from each query, in a stream. Read more
Execute the query and returns at most one row.
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Any> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Any> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Any> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Any> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
Prepare the SQL query, with parameter type information, to inspect the type information about its parameters and results. Read more
Execute the query and return the total number of rows affected.
Execute multiple queries and return the rows affected from each query, in a stream.
Execute the query and return the generated results as a stream.
Execute the query and return all the generated results, collected into a Vec
.
Execute the query and returns exactly one row.
Execute multiple queries and return the generated results as a stream from each query, in a stream. Read more
Execute the query and returns at most one row.
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Mssql> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Mssql> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
pub fn prepare_with<'e, 'q>(
self,
sql: &'q str,
parameters: &'e [<<&'t mut Transaction<'c, Mssql> as Executor<'t>>::Database as Database>::TypeInfo]
) -> Pin<Box<dyn Future<Output = Result<<<&'t mut Transaction<'c, Mssql> as Executor<'t>>::Database as HasStatement<'q>>::Statement, Error>> + Send + 'e, Global>> where
'q: 'e,
't: 'e,
Prepare the SQL query, with parameter type information, to inspect the type information about its parameters and results. Read more
Execute the query and return the total number of rows affected.
Execute multiple queries and return the rows affected from each query, in a stream.
Execute the query and return the generated results as a stream.
Execute the query and return all the generated results, collected into a Vec
.
Execute the query and returns exactly one row.