5#ifndef SQLITEDBSVC_STATEMENT_H
6#define SQLITEDBSVC_STATEMENT_H
10#include <source_location>
22 requires std::convertible_to<T, std::int64_t> ||
23 std::convertible_to<T, double> ||
24 std::convertible_to<T, std::string_view>;
30 requires std::same_as<std::remove_cvref_t<T>, T> &&
31 (std::is_arithmetic_v<T> || std::same_as<T, std::string>);
36 requires(
sizeof...(Args) >= 1)
40template <
typename...
Args>
55 Statement(sqlite3* db, std::string_view sql, std::source_location call);
78 requires std::integral<I>
83 void bind(
int index, std::string_view value);
86 template <Val
idColumnType T, std::
size_t I>
90 std::tuple<Ts...>
columns(std::index_sequence<Is...>);
std::tuple< Ts... > columns(std::index_sequence< Is... >)
Retrieve columns.
void reset()
Reset prepared statement for re-execution and clear bindings.
Statement & operator=(Statement &&rhs) noexcept
Move assignment operator allows Statement member variables to be filled from createStatement.
Statement(sqlite3 *db, std::string_view sql, std::source_location call)
Create a prepared statement attached to an SQLiteDBSvc This class should be constructed using the cre...
Statement(const Statement &)=delete
void bind(int index, std::int64_t value)
Bind an integer to a parameter.
T column()
Retrieve a column.
void bind(int index, I value)
std::recursive_mutex m_stmtMutex
ResultTypeWrapper< ReturnArgs... >::type run(ParamArgs... params)
Run the statement.
std::source_location m_creationPoint
bool step()
Step through the prepared statement.
Test if a type is a valid placeholder for some SQLite column type.
Test if a type is a valid SQLite parameter type.
std::vector< std::tuple< Args... > > ResultType
Return type for result of an SQL statement that returns data.
Helper to return void if Args is empty or void.
ResultType< Args... > type