MIRA
|
A cached SQLite query object that supports serialization. More...
#include <database/SQLiteQuery.h>
Public Types | |
typedef std::vector< std::string > | HeaderVector |
typedef std::vector< std::vector< std::pair< int, std::string > > > | ValueVector |
Public Member Functions | |
template<typename Reflector > | |
void | reflect (Reflector &r) |
Reflect method for serialization. More... | |
Constructors and destructor | |
SQLiteCachedQuery () | |
Default constructor. More... | |
SQLiteCachedQuery (SQLiteQuery &query) | |
The copy constructor. More... | |
Query operations | |
bool | eof () const |
Return if the query contains data. More... | |
int | getColumnCount () const |
Return the column count of the query. More... | |
std::string | getName (std::size_t column) |
Returns the name of a given column. More... | |
template<typename T > | |
T | getValue (std::size_t column) |
Returns a typecasted value for a given column in the current row. More... | |
template<typename T > | |
T | getValue (std::size_t column, const T &defaultValue) |
Returns a typecasted value for a given column in the current row. More... | |
int | getDataType (std::size_t column) |
Get the data type of a given column in the current row. More... | |
bool | isNull (std::size_t column) |
Return if a entry in a given column is NULL. More... | |
void | next () |
Advance to next row. More... | |
SQLiteCachedQuery & | operator++ () |
Preincrement operator. More... | |
ValueVector | getValues () const |
Return the cached values. More... | |
Protected Member Functions | |
void | validate () |
void | validate (std::size_t column) |
Protected Attributes | |
HeaderVector | mHeader |
ValueVector | mCache |
std::size_t | mCurrent |
A cached SQLite query object that supports serialization.
Can be used to store a database query in a log file or for for RPC database query.
typedef std::vector<std::string> HeaderVector |
typedef std::vector<std::vector<std::pair<int, std::string> > > ValueVector |
Default constructor.
SQLiteCachedQuery | ( | SQLiteQuery & | query | ) |
The copy constructor.
|
inline |
Return if the query contains data.
|
inline |
Return the column count of the query.
|
inline |
Returns the name of a given column.
[in] | column | The column |
|
inline |
Returns a typecasted value for a given column in the current row.
XBadCast | if the element in the data field is NULL. |
[in] | column | The column to be returned. |
|
inline |
Returns a typecasted value for a given column in the current row.
If this value is NULL a default value is returned.
[in] | column | The column to be returned. |
[in] | defaultValue | The default value that is returned if the cast fails. |
int getDataType | ( | std::size_t | column | ) |
Get the data type of a given column in the current row.
Could be one of the following: SQLITE_INTEGER = int SQLITE_FLOAT = float SQLITE_TEXT = string SQLITE_BLOB = string SQLITE_NULL = NULL
bool isNull | ( | std::size_t | column | ) |
Return if a entry in a given column is NULL.
|
inline |
Advance to next row.
/code while (!query.eof()) { ... query.next(); } /endcode
|
inline |
Preincrement operator.
Same as next().
|
inline |
Return the cached values.
|
inline |
Reflect method for serialization.
|
inlineprotected |
|
inlineprotected |
|
protected |
|
protected |
|
protected |