#include <Query.h>
Public Member Functions | |
Query (Database &dbin) | |
Constructor accepting reference to database object. | |
Query (Database &dbin, const std::string &sql) | |
Constructor accepting reference to database object and query string to execute. | |
~Query () | |
Destructor. | |
bool | Connected () |
Check if database object is connectable. | |
Database & | GetDatabase () const |
Return reference to database object. | |
const std::string & | GetLastQuery () |
Return string containing last query executed. | |
bool | execute (const std::string &sql) |
execute() returns true if query is successful, does not store result. | |
sqlite3_stmt * | get_result (const std::string &sql) |
Execute query and store result. | |
void | free_result () |
Free stored result, must be called after get_result() before calling execute()/get_result() again. | |
bool | fetch_row () |
Fetch next result row. | |
sqlite_int64 | insert_id () |
Get id of last insert. | |
long | num_rows () |
Returns 0 if there are no rows to fetch. | |
std::string | GetError () |
Last error string. | |
int | GetErrno () |
Last error code. | |
const char * | get_string (const std::string &sql) |
Execute query and return first result as a string. | |
long | get_count (const std::string &sql) |
Execute query and return first result as a long integer. | |
double | get_num (const std::string &sql) |
Execute query and return first result as a double. | |
bool | is_null (int x) |
Check if column x in current row is null. | |
const char * | getstr (const std::string &x) |
Return column named x as a string value. | |
const char * | getstr (int x) |
Return column x as a string value. | |
const char * | getstr () |
Return next column as a string value - see rowcount. | |
long | getval (const std::string &x) |
Return column named x as a long integer. | |
long | getval (int x) |
Return column x as a long integer. | |
long | getval () |
Return next column as a long integer - see rowcount. | |
unsigned long | getuval (const std::string &x) |
Return column named x as an unsigned long integer. | |
unsigned long | getuval (int x) |
Return column x as an unsigned long integer. | |
unsigned long | getuval () |
Return next column as an unsigned long integer. | |
int64_t | getbigint (const std::string &x) |
Return column named x as a 64-bit integer value. | |
int64_t | getbigint (int x) |
Return column x as a 64-bit integer value. | |
int64_t | getbigint () |
Return next column as a 64-bit integer value. | |
uint64_t | getubigint (const std::string &x) |
Return column named x as an unsigned 64-bit integer value. | |
uint64_t | getubigint (int x) |
Return column x as an unsigned 64-bit integer value. | |
uint64_t | getubigint () |
Return next column as an unsigned 64-bit integer value. | |
double | getnum (const std::string &x) |
Return column named x as a double. | |
double | getnum (int x) |
Return column x as a double. | |
double | getnum () |
Return next column as a double. |
Definition at line 56 of file Query.h.
Query::Query | ( | Database & | dbin | ) |
Constructor accepting reference to database object.
Query::Query | ( | Database & | dbin, | |
const std::string & | sql | |||
) |
Constructor accepting reference to database object and query string to execute.
Query::~Query | ( | ) |
Destructor.
bool Query::Connected | ( | ) |
Check if database object is connectable.
Database& Query::GetDatabase | ( | ) | const |
Return reference to database object.
const std::string& Query::GetLastQuery | ( | ) |
Return string containing last query executed.
bool Query::execute | ( | const std::string & | sql | ) |
execute() returns true if query is successful, does not store result.
sqlite3_stmt* Query::get_result | ( | const std::string & | sql | ) |
Execute query and store result.
void Query::free_result | ( | ) |
Free stored result, must be called after get_result() before calling execute()/get_result() again.
bool Query::fetch_row | ( | ) |
Fetch next result row.
sqlite_int64 Query::insert_id | ( | ) |
Get id of last insert.
long Query::num_rows | ( | ) |
Returns 0 if there are no rows to fetch.
std::string Query::GetError | ( | ) |
Last error string.
int Query::GetErrno | ( | ) |
Last error code.
const char* Query::get_string | ( | const std::string & | sql | ) |
Execute query and return first result as a string.
long Query::get_count | ( | const std::string & | sql | ) |
Execute query and return first result as a long integer.
double Query::get_num | ( | const std::string & | sql | ) |
Execute query and return first result as a double.
bool Query::is_null | ( | int | x | ) |
Check if column x in current row is null.
const char* Query::getstr | ( | const std::string & | x | ) |
Return column named x as a string value.
const char* Query::getstr | ( | int | x | ) |
Return column x as a string value.
const char* Query::getstr | ( | ) |
Return next column as a string value - see rowcount.
long Query::getval | ( | const std::string & | x | ) |
Return column named x as a long integer.
long Query::getval | ( | int | x | ) |
Return column x as a long integer.
long Query::getval | ( | ) |
Return next column as a long integer - see rowcount.
unsigned long Query::getuval | ( | const std::string & | x | ) |
Return column named x as an unsigned long integer.
unsigned long Query::getuval | ( | int | x | ) |
Return column x as an unsigned long integer.
unsigned long Query::getuval | ( | ) |
Return next column as an unsigned long integer.
int64_t Query::getbigint | ( | const std::string & | x | ) |
Return column named x as a 64-bit integer value.
int64_t Query::getbigint | ( | int | x | ) |
Return column x as a 64-bit integer value.
int64_t Query::getbigint | ( | ) |
Return next column as a 64-bit integer value.
uint64_t Query::getubigint | ( | const std::string & | x | ) |
Return column named x as an unsigned 64-bit integer value.
uint64_t Query::getubigint | ( | int | x | ) |
Return column x as an unsigned 64-bit integer value.
uint64_t Query::getubigint | ( | ) |
Return next column as an unsigned 64-bit integer value.
double Query::getnum | ( | const std::string & | x | ) |
Return column named x as a double.
double Query::getnum | ( | int | x | ) |
Return column x as a double.
double Query::getnum | ( | ) |
Return next column as a double.