dodo
0.0.1
A C++ library to create containerized Linux services
|
Data Modification Language statements can take bind values. More...
#include <sqlite.hpp>
Public Member Functions | |
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... | |
Data Modification Language statements can take bind values.
Note that calling reset leaves set bind values intact.
Definition at line 294 of file sqlite.hpp.
dodo::persist::sqlite::DML::DML | ( | const Database & | db | ) |
|
inlinevirtual |
Destructor.
Definition at line 304 of file sqlite.hpp.
void dodo::persist::sqlite::DML::bind | ( | const std::string & | name, |
const common::Bytes & | value | ||
) |
Bind a string value to the bind by name.
Note that this is less efficient than binding by index/position.
name | The name of the bind parameter. |
value | the value to bind. |
Definition at line 470 of file sqlite.cpp.
References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | const std::string & | name, |
const std::string & | value | ||
) |
Bind a string value to the bind by name.
Note that this is less efficient than binding by index/position.
name | The name of the bind parameter. |
value | the value to bind. |
Definition at line 464 of file sqlite.cpp.
References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | const std::string & | name, |
double | value | ||
) |
Bind a string value to the bind by name.
Note that this is less efficient than binding by index/position.
name | The name of the bind parameter. |
value | the value to bind. |
Definition at line 446 of file sqlite.cpp.
References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | const std::string & | name, |
int | value | ||
) |
Bind a string value to the bind by name.
Note that this is less efficient than binding by index/position.
name | The name of the bind parameter. |
value | the value to bind. |
Definition at line 452 of file sqlite.cpp.
References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | const std::string & | name, |
int64_t | value | ||
) |
Bind a string value to the bind by name.
Note that this is less efficient than binding by index/position.
name | The name of the bind parameter. |
value | the value to bind. |
Definition at line 458 of file sqlite.cpp.
References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | int | position, |
const common::Bytes & | value | ||
) |
Bind an Bytes value to the bind at position.
position | the bind position in the SQL (start with 1) |
value | the value to bind. |
Definition at line 439 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::database_, dodo::common::Bytes::getArray(), dodo::common::Bytes::getSize(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | int | position, |
const std::string & | value | ||
) |
Bind a string value to the bind at position.
position | the bind position in the SQL (start with 1) |
value | the value to bind. |
Definition at line 432 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | int | position, |
double | value | ||
) |
Bind a double value to the bind at position.
position | the bind position in the SQL (start with 1) |
value | the value to bind. |
Definition at line 411 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
Referenced by bind(), dodo::persist::KVStore::deleteKey(), dodo::persist::KVStore::exists(), dodo::persist::KVStore::filterKeys(), dodo::persist::KVStore::getMetaData(), dodo::persist::KVStore::getValue(), dodo::persist::KVStore::insertKey(), and dodo::persist::KVStore::setKey().
void dodo::persist::sqlite::DML::bind | ( | int | position, |
int | value | ||
) |
Bind an int value to the bind at position.
position | the bind position in the SQL (start with 1) |
value | the value to bind. |
Definition at line 418 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
void dodo::persist::sqlite::DML::bind | ( | int | position, |
int64_t | value | ||
) |
Bind a int64_t value to the bind at position.
position | the bind position in the SQL (start with 1) |
value | the value to bind. |
Definition at line 425 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
int dodo::persist::sqlite::DML::execute | ( | ) |
Execute and return the number of rows affected.
Definition at line 403 of file sqlite.cpp.
References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.
Referenced by dodo::persist::KVStore::deleteKey(), dodo::persist::KVStore::insertKey(), and dodo::persist::KVStore::setKey().