A sqlite statement.
More...
#include <sqlstatement.h>
|
| SqlStatement (const std::shared_ptr< sqlite3 > &database, const std::string &command) |
| Constructs a SqlStatement.
|
|
bool | bind (int index, int value) |
| Binds an int to a parameter.
|
|
bool | bind (int index, sqlite3_int64 value) |
| Binds an int64 to a parameter.
|
|
bool | bind (int index, double value) |
| Binds a double to a parameter.
|
|
bool | bind (int index, bool value) |
| Binds a bool to a parameter.
|
|
bool | bind (int index, const std::string &value) |
| Binds a string to a parameter.
|
|
bool | bind (int index, void *value, int n) |
| Binds a blob to a parameter.
|
|
bool | step () |
| Steps through the statement.
|
|
int | getColumnInt (int index) const |
| Gets an int from a column.
|
|
sqlite3_int64 | getColumnInt64 (int index) const |
| Gets an int64 from a column.
|
|
double | getColumnDouble (int index) const |
| Gets a double from a column.
|
|
bool | getColumnBool (int index) const |
| Gets a bool from a column.
|
|
std::string | getColumnString (int index) const |
| Gets a string from a column.
|
|
std::pair< const void *, size_t > | getColumnBlob (int index) const |
| Gets a blob from a column.
|
|
| operator bool () const |
| Gets whether or not the object is valid or not.
|
|
◆ SqlStatement()
Nickvision::Database::SqlStatement::SqlStatement |
( |
const std::shared_ptr< sqlite3 > & | database, |
|
|
const std::string & | command ) |
Constructs a SqlStatement.
- Parameters
-
database | The sqlite3 database |
command | The sql command to bind to the statement |
- Exceptions
-
std::runtime_error | Thrown if error in executing sql statement |
◆ bind() [1/6]
bool Nickvision::Database::SqlStatement::bind |
( |
int | index, |
|
|
bool | value ) |
Binds a bool to a parameter.
- Parameters
-
index | The index of the parameter |
value | The bool to bind |
- Returns
- True if bind was successful, else false
◆ bind() [2/6]
bool Nickvision::Database::SqlStatement::bind |
( |
int | index, |
|
|
const std::string & | value ) |
Binds a string to a parameter.
- Parameters
-
index | The index of the parameter |
value | The string to bind |
- Returns
- True if bind was successful, else false
◆ bind() [3/6]
bool Nickvision::Database::SqlStatement::bind |
( |
int | index, |
|
|
double | value ) |
Binds a double to a parameter.
- Parameters
-
index | The index of the parameter |
value | The double to bind |
- Returns
- True if bind was successful, else false
◆ bind() [4/6]
bool Nickvision::Database::SqlStatement::bind |
( |
int | index, |
|
|
int | value ) |
Binds an int to a parameter.
- Parameters
-
index | The index of the parameter |
value | The int to bind |
- Returns
- True if bind was successful, else false
◆ bind() [5/6]
bool Nickvision::Database::SqlStatement::bind |
( |
int | index, |
|
|
sqlite3_int64 | value ) |
Binds an int64 to a parameter.
- Parameters
-
index | The index of the parameter |
value | The int64 to bind |
- Returns
- True if bind was successful, else false
◆ bind() [6/6]
bool Nickvision::Database::SqlStatement::bind |
( |
int | index, |
|
|
void * | value, |
|
|
int | n ) |
Binds a blob to a parameter.
- Parameters
-
index | The index of the parameter |
value | The blob to bind |
n | The size of the blob |
- Returns
- True if bind was successful, else false
◆ getColumnBlob()
std::pair< const void *, size_t > Nickvision::Database::SqlStatement::getColumnBlob |
( |
int | index | ) |
const |
Gets a blob from a column.
- Parameters
-
index | The index of the column |
- Returns
- A pair of the blob from the column and the blob's size
◆ getColumnBool()
bool Nickvision::Database::SqlStatement::getColumnBool |
( |
int | index | ) |
const |
Gets a bool from a column.
- Parameters
-
index | The index of the column |
- Returns
- The bool from the column
◆ getColumnDouble()
double Nickvision::Database::SqlStatement::getColumnDouble |
( |
int | index | ) |
const |
Gets a double from a column.
- Parameters
-
index | The index of the column |
- Returns
- The double from the column
◆ getColumnInt()
int Nickvision::Database::SqlStatement::getColumnInt |
( |
int | index | ) |
const |
Gets an int from a column.
- Parameters
-
index | The index of the column |
- Returns
- The int from the column
◆ getColumnInt64()
sqlite3_int64 Nickvision::Database::SqlStatement::getColumnInt64 |
( |
int | index | ) |
const |
Gets an int64 from a column.
- Parameters
-
index | The index of the column |
- Returns
- The int64 from the column
◆ getColumnString()
std::string Nickvision::Database::SqlStatement::getColumnString |
( |
int | index | ) |
const |
Gets a string from a column.
- Parameters
-
index | The index of the column |
- Returns
- The string from the column
◆ operator bool()
Nickvision::Database::SqlStatement::operator bool |
( |
| ) |
const |
Gets whether or not the object is valid or not.
- Returns
- True if valid, else false
◆ step()
bool Nickvision::Database::SqlStatement::step |
( |
| ) |
|
Steps through the statement.
- Returns
- True if SQLITE_ROW, else false
- Exceptions
-
std::runtime_error | Thrown if error in executing sql statement |
The documentation for this class was generated from the following file: