SQLite for C++
|
Public Member Functions | |
PreparedStatement (Conn &conn, const std::string &stmt) | |
sqlite3_stmt * | get_ptr () |
void | commit () |
void | next () |
void | close () noexcept |
Binding Values | |
void | bind (Args... args) |
template<typename T > | |
void | bind (const size_t i, const T value) |
template<> | |
void | bind (const size_t i, const char *value) |
template<> | |
void | bind (const size_t i, const std::string value) |
template<> | |
void | bind (const size_t i, const int value) |
template<> | |
void | bind (const size_t i, const long int value) |
template<> | |
void | bind (const size_t i, double value) |
Protected Attributes | |
int | params |
Conn * | conn |
std::shared_ptr< stmt_base > | base = std::make_shared<stmt_base>() |
const char * | unused |
Private Member Functions | |
Variadic bind() Helpers | |
template<typename T > | |
void | _bind_many (size_t i, T value) |
template<typename T , typename... Args> | |
void | _bind_many (size_t i, T value, Args... args) |
An interface for executing and iterating through SQL statements
SQLite::Conn::PreparedStatement::PreparedStatement | ( | Conn & | conn, |
const std::string & | stmt | ||
) |
Prepare a SQL statement
[in] | conn | An active SQLite connection |
[out] | stmt | A SQL query that should be prepared |
|
inline |
Bind any number of arguments to the statement and automatically call next()
If too many arguments are bound, an error will be thrown at runtime.
|
inline |
Bind text values to the statement
Note: This function is zero-indexed while sqlite3_bind_* is 1-indexed
|
inline |
Bind integer values to the statement
|
inline |
Bind integer values to the statement
|
inline |
Bind floating point values to the statement
|
noexcept |
Close the prepared statement
void SQLite::Conn::PreparedStatement::commit | ( | ) |
End a transaction
sqlite3_stmt * SQLite::Conn::PreparedStatement::get_ptr | ( | ) |
Get a raw pointer to the underlying sqlite3_stmt
void SQLite::Conn::PreparedStatement::next | ( | ) |
Call after bind()-ing values to execute statement