dodo
0.0.1
A C++ library to create containerized Linux services
|
Queries can take bind values and return select lists. More...
#include <sqlite.hpp>
Public Types | |
enum | DataType { dtInteger = SQLITE_INTEGER, dtFloat = SQLITE_FLOAT, dtText = SQLITE3_TEXT, dtBlob = SQLITE_BLOB, dtNull = SQLITE_NULL, dtUnknown = 91 } |
The data type of a select-list value. More... | |
Public Member Functions | |
Query (const Database &db) | |
Constructor. More... | |
virtual | ~Query () |
Destructor. More... | |
void | getBytes (int col, common::Bytes &bytes) const |
Get Bytes value from select list. More... | |
int | getColumnCount () const |
get the number of columns in the query result set. More... | |
DataType | getDataType (int col) const |
Get the dataype of a select list column. More... | |
double | getDouble (int col) const |
Get double value from select list. More... | |
int | getInt (int col) const |
Get int value from select list. More... | |
int64_t | getInt64 (int col) const |
Get int64_t value from select list. More... | |
std::string | getText (int col) const |
Get string value from select list. More... | |
bool | isNull (int col) const |
Test if the result is NULL. More... | |
bool | step () |
Step the result list, end of list returns false. More... | |
![]() | |
DML (const Database &db) | |
Constructor. More... | |
virtual | ~DML () |
Destructor. More... | |
void | bind (const std::string &name, const common::Bytes &value) |
Bind a string value to the bind by name. More... | |
void | bind (const std::string &name, const std::string &value) |
Bind a string value to the bind by name. More... | |
void | bind (const std::string &name, double value) |
Bind a string value to the bind by name. More... | |
void | bind (const std::string &name, int value) |
Bind a string value to the bind by name. More... | |
void | bind (const std::string &name, int64_t value) |
Bind a string value to the bind by name. More... | |
void | bind (int position, const common::Bytes &value) |
Bind an Bytes value to the bind at position. More... | |
void | bind (int position, const std::string &value) |
Bind a string value to the bind at position. More... | |
void | bind (int position, double value) |
Bind a double value to the bind at position. More... | |
void | bind (int position, int value) |
Bind an int value to the bind at position. More... | |
void | bind (int position, int64_t value) |
Bind a int64_t value to the bind at position. More... | |
int | execute () |
Execute and return the number of rows affected. More... | |
![]() | |
Statement (const Database &db) | |
Constructor. More... | |
virtual | ~Statement () |
Destructor. More... | |
void | close () |
A statement handle can be explicitly closed without deleting the Statement object itself. More... | |
void | prepare (const std::string &sql) |
Prepare a SQL statement. More... | |
void | reset (bool clear=true) |
Reset a SQL statement for re-execute or even re-prepare. More... | |
Additional Inherited Members | |
![]() | |
sqlite3 * | database_ |
database handle on which the stmt_ is created. More... | |
sqlite3_stmt * | stmt_ |
statement handle. More... | |
Queries can take bind values and return select lists.
Definition at line 387 of file sqlite.hpp.
The data type of a select-list value.
Definition at line 393 of file sqlite.hpp.
|
inline |
|
inlinevirtual |
Destructor.
Definition at line 409 of file sqlite.hpp.
void dodo::persist::sqlite::Query::getBytes | ( | int | col, |
common::Bytes & | bytes | ||
) | const |
Get Bytes value from select list.
col | the select list column (start with 0). |
bytes | The Bytes value to get. |
Definition at line 509 of file sqlite.cpp.
References dodo::common::Bytes::append(), dodo::common::Bytes::free(), and dodo::persist::sqlite::Statement::stmt_.
Referenced by dodo::persist::KVStore::getValue().
int dodo::persist::sqlite::Query::getColumnCount | ( | ) | const |
get the number of columns in the query result set.
Definition at line 516 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::stmt_.
Query::DataType dodo::persist::sqlite::Query::getDataType | ( | int | col | ) | const |
Get the dataype of a select list column.
col | The column index (start with 0). |
Definition at line 488 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::stmt_.
Referenced by dodo::persist::KVStore::getMetaData().
double dodo::persist::sqlite::Query::getDouble | ( | int | col | ) | const |
Get double value from select list.
col | the select list column (start with 0). |
Definition at line 500 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::stmt_.
Referenced by dodo::persist::KVStore::getMetaData(), and dodo::persist::KVStore::getValue().
int dodo::persist::sqlite::Query::getInt | ( | int | col | ) | const |
Get int value from select list.
col | the select list column (start with 0). |
Definition at line 492 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::stmt_.
Referenced by dodo::persist::KVStore::exists(), and dodo::persist::sqlite::Database::getUserVersion().
int64_t dodo::persist::sqlite::Query::getInt64 | ( | int | col | ) | const |
Get int64_t value from select list.
col | the select list column (start with 0). |
Definition at line 496 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::stmt_.
Referenced by dodo::persist::KVStore::getMetaData(), and dodo::persist::KVStore::getValue().
std::string dodo::persist::sqlite::Query::getText | ( | int | col | ) | const |
Get string value from select list.
col | the select list column (start with 0). |
Definition at line 504 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::stmt_.
Referenced by dodo::persist::KVStore::filterKeys(), and dodo::persist::KVStore::getValue().
bool dodo::persist::sqlite::Query::isNull | ( | int | col | ) | const |
Test if the result is NULL.
col | the select list column (start with 0). |
Definition at line 484 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::stmt_.
bool dodo::persist::sqlite::Query::step | ( | ) |
Step the result list, end of list returns false.
Definition at line 476 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
Referenced by dodo::persist::KVStore::createSchema(), dodo::persist::KVStore::exists(), dodo::persist::KVStore::filterKeys(), dodo::persist::KVStore::getMetaData(), dodo::persist::sqlite::Database::getUserVersion(), and dodo::persist::KVStore::getValue().