Sqlite statement wrapper. More...
#include <Statement.h>
Data Structures | |
class | BindWrap |
class | BindWrap< double > |
class | BindWrap< int > |
class | BindWrap< int64_t > |
class | BindWrap< std::string > |
class | ColType |
class | ColType< double > |
class | ColType< int > |
class | ColType< int64_t > |
class | ColType< std::string > |
Public Member Functions | |
Statement () | |
Constructs empty statement calling anything on it will cause InvalidUseException. | |
Statement (std::string const &sql, Database &db) | |
Constructs statement. | |
virtual | ~Statement () |
Statement (Statement const &) | |
Statement & | operator= (Statement const &) |
Statement (Statement &&other) | |
Statement & | operator= (Statement &&other) |
bool | done () |
bool | has_row () |
void | step () |
Step the statement as in get next row or execute insert, update etc. | |
void | reset () |
Reset the statement. | |
void | finalize () |
Finalizes the statement before destruction. | |
double | val_double (int col_index) |
int | val_int (int col_index) |
int64_t | val_int64 (int col_index) |
std::string | val_string (int col_index) |
void | bind_double (int param_index, double value) |
Binds a value to prepared statement parameter. | |
void | bind_int (int param_index, int value) |
Binds a value to prepared statement parameter. | |
void | bind_int64 (int param_index, int64_t value) |
Binds a value to prepared statement parameter. | |
void | bind_string (int param_index, std::string const &value) |
Binds a value to prepared statement parameter. | |
template<typename... Args> | |
std::tuple< Args...> | get_row (ColType< Args >...types) |
template<typename... Args> | |
std::vector< std::tuple< Args...> > | get_remaining_rows (ColType< Args >...types) |
template<typename... Args> | |
void | bind (Args...values) |
Binds more values to parameters Starts with index 1. | |
Static Public Attributes | |
static ColType< int > | colint |
Column type int. | |
static ColType< double > | coldouble |
Column type double. | |
static ColType< int64_t > | colint64 |
Column type int64. | |
static ColType< std::string > | colstring |
Column type string. | |
Friends | |
Statement::ColType< double > | coldouble () |
Statement::ColType< int > | colint () |
Statement::ColType< int64_t > | colint64 () |
Statement::ColType< std::string > | colstr () |
Sqlite statement wrapper.
Finalizes statement on destruction.
Definition at line 26 of file Statement.h.
sqlite::Statement::Statement | ( | ) |
Constructs empty statement calling anything on it will cause InvalidUseException.
Definition at line 17 of file Statement.cpp.
sqlite::Statement::Statement | ( | std::string const & | sql, |
Database & | db | ||
) |
Constructs statement.
Also registers the constructed statement with the database connection.
sql | sql statement |
db | database connection |
Definition at line 26 of file Statement.cpp.
sqlite::Statement::~Statement | ( | ) | [virtual] |
Definition at line 45 of file Statement.cpp.
sqlite::Statement::Statement | ( | Statement const & | ) |
sqlite::Statement::Statement | ( | Statement && | other | ) |
Definition at line 65 of file Statement.cpp.
void sqlite::Statement::bind | ( | Args... | values | ) | [inline] |
Binds more values to parameters Starts with index 1.
values | values to bind |
Definition at line 174 of file Statement.h.
void sqlite::Statement::bind_double | ( | int | param_index, |
double | value | ||
) |
Binds a value to prepared statement parameter.
param_index | |
value |
Definition at line 173 of file Statement.cpp.
void sqlite::Statement::bind_int | ( | int | param_index, |
int | value | ||
) |
Binds a value to prepared statement parameter.
param_index | |
value |
Definition at line 178 of file Statement.cpp.
void sqlite::Statement::bind_int64 | ( | int | param_index, |
int64_t | value | ||
) |
Binds a value to prepared statement parameter.
param_index | |
value |
Definition at line 183 of file Statement.cpp.
void sqlite::Statement::bind_string | ( | int | param_index, |
std::string const & | value | ||
) |
Binds a value to prepared statement parameter.
param_index | |
value |
Definition at line 188 of file Statement.cpp.
bool sqlite::Statement::done | ( | ) |
Definition at line 72 of file Statement.cpp.
void sqlite::Statement::finalize | ( | ) |
Finalizes the statement before destruction.
No other function than finalize can be called on it after this.
Definition at line 223 of file Statement.cpp.
std::vector<std::tuple<Args...> > sqlite::Statement::get_remaining_rows | ( | ColType< Args >... | types | ) | [inline] |
types | the same as in get_row |
Definition at line 157 of file Statement.h.
std::tuple<Args...> sqlite::Statement::get_row | ( | ColType< Args >... | types | ) | [inline] |
bool sqlite::Statement::has_row | ( | ) |
Definition at line 79 of file Statement.cpp.
Definition at line 50 of file Statement.cpp.
void sqlite::Statement::reset | ( | ) |
Reset the statement.
Resets done and has_row flags. If it is a query stepping will result in rows being returned from beginning again. Otherwise it has no apparent reason to call this since step can be called again even without reset.
Definition at line 120 of file Statement.cpp.
void sqlite::Statement::step | ( | ) |
Step the statement as in get next row or execute insert, update etc.
Definition at line 86 of file Statement.cpp.
double sqlite::Statement::val_double | ( | int | col_index | ) |
col_index | index of retrieved column |
Definition at line 147 of file Statement.cpp.
int sqlite::Statement::val_int | ( | int | col_index | ) |
col_index | index of retrieved column |
Definition at line 159 of file Statement.cpp.
int64_t sqlite::Statement::val_int64 | ( | int | col_index | ) |
col_index | index of retrieved column |
Definition at line 153 of file Statement.cpp.
std::string sqlite::Statement::val_string | ( | int | col_index | ) |
col_index | index of retrieved column |
Definition at line 165 of file Statement.cpp.
Statement::ColType<double> coldouble | ( | ) | [friend] |
Definition at line 193 of file Statement.cpp.
Statement::ColType<int> colint | ( | ) | [friend] |
Definition at line 198 of file Statement.cpp.
Statement::ColType<int64_t> colint64 | ( | ) | [friend] |
Definition at line 203 of file Statement.cpp.
Statement::ColType<std::string> colstr | ( | ) | [friend] |
Definition at line 208 of file Statement.cpp.
ColType<double> sqlite::Statement::coldouble [static] |
Column type double.
Definition at line 186 of file Statement.h.
ColType<int> sqlite::Statement::colint [static] |
Column type int.
Definition at line 182 of file Statement.h.
ColType<int64_t> sqlite::Statement::colint64 [static] |
Column type int64.
Definition at line 190 of file Statement.h.
ColType<std::string> sqlite::Statement::colstring [static] |
Column type string.
Definition at line 194 of file Statement.h.