#include <userver/storages/sqlite/savepoint.hpp>
RAII savepoint wrapper, auto-ROLLBACKs on destruction if no prior Release
/Rollback
call was made.
This type can't be constructed in user code and is always retrieved from storages::sqlite::Client
Definition at line 23 of file savepoint.hpp.
Public Member Functions | |
Savepoint (std::shared_ptr< infra::ConnectionPtr > connection, std::string name) | |
Savepoint (const Savepoint &other)=delete | |
Savepoint (Savepoint &&other) noexcept | |
Savepoint & | operator= (Savepoint &&) noexcept |
template<typename... Args> | |
ResultSet | Execute (const Query &query, const Args &... args) const |
Executes a statement. | |
template<typename T> | |
ResultSet | ExecuteDecompose (const Query &query, const T &row) const |
Executes a statement, decomposing the row. | |
template<typename Container> | |
void | ExecuteMany (const Query &query, const Container ¶ms) const |
Executes a statement multiple times. | |
template<typename T, typename... Args> | |
CursorResultSet< T > | GetCursor (std::size_t batch_size, const Query &query, const Args &... args) const |
Executes a statement and returns a cursor for iterating over results. | |
Savepoint | Save (std::string name) const |
Creates a wrapped savepoint with specified name. | |
void | Release () |
Release the savepint. | |
void | RollbackTo () |
Rollback the savepint. | |
ResultSet storages::sqlite::Savepoint::Execute | ( | const Query & | query, |
const Args &... | args ) const |
Executes a statement.
Fills placeholders of the statement with args..., Args
are expected to be of supported types. See SQLite supported types for better understanding of Args
requirements.
Args | Types of parameters to bind |
query | SQL query to execute |
args | Parameters to bind to the query |
Definition at line 112 of file savepoint.hpp.
ResultSet storages::sqlite::Savepoint::ExecuteDecompose | ( | const Query & | query, |
const T & | row ) const |
Executes a statement, decomposing the row.
Decomposes the fields of the row and binds them as parameters to the query. See SQLite supported types for better understanding of T
requirements.
T | Type of the row to decompose |
query | SQL query to execute |
row | Row object to decompose and bind |
Definition at line 125 of file savepoint.hpp.
void storages::sqlite::Savepoint::ExecuteMany | ( | const Query & | query, |
const Container & | params ) const |
Executes a statement multiple times.
Iterates over the container and executes the query for each element. Container is expected to be a std::Container, Container::value_type is expected to be an aggregate of supported types. See MySQL supported types for better understanding of Container::value_type
requirements.
Container | Type of the container holding rows |
query | SQL query to execute |
params | Container of rows to bind and execute |
Definition at line 138 of file savepoint.hpp.
CursorResultSet< T > storages::sqlite::Savepoint::GetCursor | ( | std::size_t | batch_size, |
const Query & | query, | ||
const Args &... | args ) const |
Executes a statement and returns a cursor for iterating over results.
Fills placeholders of the statement with args..., Args
are expected to be of supported types. See SQLite supported types for better understanding of Args
requirements.
T | Type of the result rows |
Args | Types of parameters to bind |
batch_size | Number of rows to fetch per batch |
query | SQL query to execute |
args | Parameters to bind to the query |
Definition at line 153 of file savepoint.hpp.
Savepoint storages::sqlite::Savepoint::Save | ( | std::string | name | ) | const |
Creates a wrapped savepoint with specified name.
name | Name of the savepoint |