#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.
|
| 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.
|
|
◆ Begin()
Begins a transaction with specified operation type and options.
- Parameters
-
operation_type | Type of the operation (e.g., Read, Write) |
options | Transaction options |
- Returns
- Transaction object representing the started transaction
◆ Execute()
template<typename... Args>
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.
- Template Parameters
-
Args | Types of parameters to bind |
- Parameters
-
operation_type | Type of the operation (e.g., Read, Write) |
query | SQL query to execute |
args | Parameters to bind to the query |
- Returns
- ResultSet containing the results of the query
Definition at line 130 of file client.hpp.
◆ ExecuteDecompose()
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.
- Template Parameters
-
T | Type of the row to decompose |
- Parameters
-
operation_type | Type of the operation (e.g., Read, Write) |
query | SQL query to execute |
row | Row object to decompose and bind |
- Returns
- ResultSet containing the results of the query
Definition at line 143 of file client.hpp.
◆ ExecuteMany()
template<typename Container>
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.
- Template Parameters
-
Container | Type of the container holding rows |
- Parameters
-
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.
◆ GetCursor()
template<typename T, typename... Args>
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
.
- Template Parameters
-
T | Type of each result row |
Args | Parameter types to bind |
- Parameters
-
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 |
- Returns
- CursorResultSet<T> lazily delivering rows in batches
Definition at line 172 of file client.hpp.
◆ Save()
Creates a savepoint with specified operation type and name.
- Parameters
-
operation_type | Type of the operation (e.g., Read, Write) |
name | Name of the savepoint |
- Returns
- Savepoint object representing the created savepoint
◆ WriteStatistics()
Writes client statistics to the provided writer.
- Parameters
-
writer | Statistics writer to output the statistics |
The documentation for this class was generated from the following file: