Your opinion will help to improve our service
Leave a feedback >#include <userver/storages/sqlite/client.hpp>
Interface for executing queries on SQLite connection. Usually retrieved from components::SQLite.
Definition at line 30 of file client.hpp.
Public Member Functions | |
Client (const settings::SQLiteSettings &settings, engine::TaskProcessor &blocking_task_processor) | |
Client constructor. | |
~Client () | |
Client destructor. | |
template<typename... Args> | |
ResultSet | Execute (OperationType operation_type, const Query &query, const Args &... args) const |
Executes a statement with provided operation type. | |
template<typename T> | |
ResultSet | ExecuteDecompose (OperationType operation_type, const Query &query, const T &row) const |
Executes a statement with provided operation type, decomposing the row. | |
template<typename Container> | |
void | ExecuteMany (OperationType operation_type, const Query &query, const Container ¶ms) const |
Executes a statement multiple times with provided operation type. | |
Transaction | Begin (OperationType operation_type, const settings::TransactionOptions &options) const |
Begins a transaction with specified operation type and options. | |
Savepoint | Save (OperationType operation_type, std::string name) const |
Creates a savepoint with specified operation type and name. | |
template<typename T, typename... Args> | |
CursorResultSet< T > | GetCursor (OperationType operation_type, std::size_t batch_size, const Query &query, const Args &... args) const |
Executes a statement and returns a lazy cursor for batched result retrieval. | |
void | WriteStatistics (utils::statistics::Writer &writer) const |
Writes client statistics to the provided writer. | |
Transaction storages::sqlite::Client::Begin | ( | OperationType | operation_type, |
const settings::TransactionOptions & | options ) const |
Begins a transaction with specified operation type and options.
operation_type | Type of the operation (e.g., Read, Write) |
options | Transaction options |
ResultSet storages::sqlite::Client::Execute | ( | OperationType | operation_type, |
const Query & | query, | ||
const Args &... | args ) const |
Executes a statement with provided operation type.
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 |
operation_type | Type of the operation (e.g., Read, Write) |
query | SQL query to execute |
args | Parameters to bind to the query |
Definition at line 130 of file client.hpp.
ResultSet storages::sqlite::Client::ExecuteDecompose | ( | OperationType | operation_type, |
const Query & | query, | ||
const T & | row ) const |
Executes a statement with provided operation type, 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 |
operation_type | Type of the operation (e.g., Read, Write) |
query | SQL query to execute |
row | Row object to decompose and bind |
Definition at line 143 of file client.hpp.
void storages::sqlite::Client::ExecuteMany | ( | OperationType | operation_type, |
const Query & | query, | ||
const Container & | params ) const |
Executes a statement multiple times with provided operation type.
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 |
operation_type | Type of the operation (e.g., Read, Write) |
query | SQL query to execute |
params | Container of rows to bind and execute |
Definition at line 156 of file client.hpp.
CursorResultSet< T > storages::sqlite::Client::GetCursor | ( | OperationType | operation_type, |
std::size_t | batch_size, | ||
const Query & | query, | ||
const Args &... | args ) const |
Executes a statement and returns a lazy cursor for batched result retrieval.
This cursor combines execution and iteration: it fetches up to batch_size
rows on each step, loading data on demand rather than all at once. Placeholders in the statement are filled with args...
, which must be of supported types. See SQLite supported types for detailed mapping of Args
.
T | Type of each result row |
Args | Parameter types to bind |
operation_type | Hint for selecting the connection pool (e.g., ReadOnly, ReadWrite) |
batch_size | Number of rows to fetch per iteration |
query | SQL query to execute |
args | Parameters to bind to the query |
Definition at line 172 of file client.hpp.
Savepoint storages::sqlite::Client::Save | ( | OperationType | operation_type, |
std::string | name ) const |
Creates a savepoint with specified operation type and name.
operation_type | Type of the operation (e.g., Read, Write) |
name | Name of the savepoint |
void storages::sqlite::Client::WriteStatistics | ( | utils::statistics::Writer & | writer | ) | const |
Writes client statistics to the provided writer.
writer | Statistics writer to output the statistics |