Represents a single SQL statement that has been compiled into binary form and is ready to be evaluated, aka "sqlite3_stmt". More...
#include <Statement.h>
Public Member Functions | |
| statement () noexcept | |
| Default constructor. More... | |
| template<typename... Values> | |
| statement (const dbconnection &connection, const std::string &text, Values &&...values) | |
| Creates, prepares, and binds values into an SQL statement. More... | |
| template<typename... Values> | |
| statement (const dbconnection &connection, const std::u16string &text, Values &&...values) | |
| Creates, prepares, and binds values into an SQL statement. More... | |
| operator bool () const noexcept | |
| Used to specify if the statement object has a prepared SQLite statement. More... | |
| sqlite3_stmt * | handle () const noexcept |
| Returns pointer to the underlying "sqlite3_stmt" object. More... | |
| template<typename... Values> | |
| void | prepare (dbconnection const &connection, const std::string &text, Values &&...values) |
| Turn an SQL query into byte code. More... | |
| template<typename... Values> | |
| void | prepare (const dbconnection &connection, const std::u16string &text, Values &&...values) |
| Turn an SQL query into byte code. More... | |
| bool | step () const |
| Evaluates a prepared statement. More... | |
| int | execute () const |
| Executes a prepared statement and will return the number of changes to the database. More... | |
| void | bind (const int index, const int value) const |
| Binds an integer value to a parameter in an SQL prepared statement. More... | |
| void | bind (const int index, const double value) const |
| Binds an double value to a parameter in an SQL prepared statement. More... | |
| void | bind (const int index, const void *const value, const int size, bindtype type=bindtype::transiently) const |
| Binds an blob value to a parameter in an SQL prepared statement. More... | |
| void | bind (const int index, const blob &value) const |
| Binds an blob value to a parameter in an SQL prepared statement. More... | |
| void | bind (const int index, const char *const value, const int size=-1, bindtype type=bindtype::transiently) const |
| Binds an string value to a parameter in an SQL prepared statement. More... | |
| void | bind (const int index, const char16_t *const value, const int size=-1, bindtype type=bindtype::transiently) const |
| Binds an UTF-16 string value to a parameter in an SQL prepared statement. More... | |
| void | bind (const int index, const std::string &value) const |
| Binds an string value to a parameter in an SQL prepared statement. More... | |
| void | bind (const int index, const std::u16string &value) const |
| Binds an UTF-16 string value to a parameter in an SQL prepared statement. More... | |
| template<typename T > | |
| void | bind_name (const std::string &name, T &&value) |
| Binds an value to a parameter in an SQL prepared statement. More... | |
| template<typename... Values> | |
| void | bind_all (Values &&...values) const |
| Binds values to parameters in an SQL prepared statement. More... | |
| template<typename... Values> | |
| void | clear_bindings (Values &&...values) const |
| Resets all SQL parameters to NULL. More... | |
| void | reset () const |
| Resets a prepared statement object back to its initial state. More... | |
| int | get_int (const int column) const noexcept |
| Returns the specified column value as an integer. More... | |
| int | get_int (const std::string &name) const noexcept |
| Returns the specified column value as an integer. More... | |
| int64_t | get_int64 (const int column) const noexcept |
| Returns the specified column value as a 64-bit integer. More... | |
| int64_t | get_int64 (const std::string &name) const noexcept |
| Returns the specified column value as a 64-bit integer. More... | |
| unsigned int | get_uint (const int column) const noexcept |
| Returns the specified column value as an unsigned integer. More... | |
| unsigned int | get_uint (const std::string &name) const noexcept |
| Returns the specified column value as an unsigned integer. More... | |
| double | get_double (const int column) const noexcept |
| Returns the specified column value as a double. More... | |
| double | get_double (const std::string &name) const noexcept |
| Returns the specified column value as a double. More... | |
| const blob | get_blob (const int column) const noexcept |
| Returns the specified column value as a blob object. More... | |
| const blob | get_blob (const std::string &name) const noexcept |
| Returns the specified column value as a Blob object. More... | |
| const std::string | get_string (const int column) const noexcept |
| Returns the specified column value as a string. More... | |
| const std::string | get_string (const std::string &name) const noexcept |
| Returns the specified column value as a string. More... | |
| const std::u16string | get_u16string (const int column) const noexcept |
| Returns the specified column value as a UTF-16 string. More... | |
| const std::u16string | get_u16string (const std::string &name) const noexcept |
| Returns the specified column value as a UTF-16 string. More... | |
| value | get_value (const int column) const noexcept |
| Returns the specified column value as a value object. More... | |
| value | get_value (const std::string &name) const |
| Returns the specified column value as a value object. More... | |
| int | get_bytes (const int column) const noexcept |
| Returns the size in bytes of the column value. More... | |
| int | get_bytes (const std::string &name) const noexcept |
| Returns the size in bytes of the column value. More... | |
| datatype | get_type (const int column) const noexcept |
| Returns the type of the specified column. More... | |
| datatype | get_type (const std::string &name) const noexcept |
| Returns the type of the specified column. More... | |
| int | column_count () const noexcept |
| Returns the number of columns in the result set returned by the prepared statement. More... | |
| const char * | get_column_name (const int index) const noexcept |
| Returns the name assigned to a particular column. More... | |
| const char16_t * | get_column_wide_name (const int index) const noexcept |
| Returns the name assigned to a particular column. More... | |
| int | get_column_index (const std::string &name) const |
| Returns the position of a column with the specified name. More... | |
Represents a single SQL statement that has been compiled into binary form and is ready to be evaluated, aka "sqlite3_stmt".
Definition at line 350 of file Statement.h.
|
noexcept |
Default constructor.
Constructs an un-prepared statement object.
Definition at line 20 of file Statement.cpp.
|
inline |
Creates, prepares, and binds values into an SQL statement.
| [in] | connection | a database connection to execute the statement on |
| [in] | text | the SQL query |
| [in] | values | possible values to bind to SQL query if containing bind parameters |
Definition at line 364 of file Statement.h.
|
inline |
Creates, prepares, and binds values into an SQL statement.
| [in] | connection | a database connection to execute the statement on |
| [in] | text | UTF-16 encoded SQL query |
| [in] | values | possible values to bind to SQL query if containing bind parameters |
Definition at line 381 of file Statement.h.
| void sqlite::statement::bind | ( | const int | index, |
| const int | value | ||
| ) | const |
Binds an integer value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
Definition at line 68 of file Statement.cpp.
| void sqlite::statement::bind | ( | const int | index, |
| const double | value | ||
| ) | const |
Binds an double value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
Definition at line 76 of file Statement.cpp.
| void sqlite::statement::bind | ( | const int | index, |
| const void *const | value, | ||
| const int | size, | ||
| bindtype | type = bindtype::transiently |
||
| ) | const |
Binds an blob value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
| [in] | size | in bytes the size of the blob object |
| [in] | type | the way to bind this parameter. |
Definition at line 84 of file Statement.cpp.
| void sqlite::statement::bind | ( | const int | index, |
| const blob & | value | ||
| ) | const |
Binds an blob value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
Definition at line 92 of file Statement.cpp.
| void sqlite::statement::bind | ( | const int | index, |
| const char *const | value, | ||
| const int | size = -1, |
||
| bindtype | type = bindtype::transiently |
||
| ) | const |
Binds an string value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
| [in] | size | the number of bytes of the value. |
| [in] | type | the way to bind this parameter. |
Definition at line 100 of file Statement.cpp.
| void sqlite::statement::bind | ( | const int | index, |
| const char16_t *const | value, | ||
| const int | size = -1, |
||
| bindtype | type = bindtype::transiently |
||
| ) | const |
Binds an UTF-16 string value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
| [in] | size | the number of bytes of the value. |
| [in] | type | the way to bind this parameter. |
Definition at line 108 of file Statement.cpp.
| void sqlite::statement::bind | ( | const int | index, |
| const std::string & | value | ||
| ) | const |
Binds an string value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
Definition at line 116 of file Statement.cpp.
| void sqlite::statement::bind | ( | const int | index, |
| const std::u16string & | value | ||
| ) | const |
Binds an UTF-16 string value to a parameter in an SQL prepared statement.
| [in] | index | specifies the index of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
Definition at line 121 of file Statement.cpp.
|
inline |
Binds values to parameters in an SQL prepared statement.
| [in] | values | the values to bind to SQL parameters |
Definition at line 511 of file Statement.h.
|
inline |
Binds an value to a parameter in an SQL prepared statement.
| [in] | name | specifies the name of the SQL parameter to be set |
| [in] | value | the value to bind to the parameter. |
Definition at line 501 of file Statement.h.
|
inline |
Resets all SQL parameters to NULL.
| [in] | values | Possible values to to bind to SQL parameters. |
Definition at line 520 of file Statement.h.
|
inlinenoexceptinherited |
Returns the number of columns in the result set returned by the prepared statement.
If this method returns 0, that means the prepared statment returns no data (for example an UPDATE).
Definition at line 234 of file Statement.h.
| int sqlite::statement::execute | ( | ) | const |
Executes a prepared statement and will return the number of changes to the database.
Definition at line 57 of file Statement.cpp.
|
inlinenoexceptinherited |
Returns the specified column value as a blob object.
| [in] | column | position of the column to return |
Definition at line 116 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a Blob object.
| [in] | name | name of the column to return |
Definition at line 126 of file Statement.h.
|
inlinenoexceptinherited |
Returns the size in bytes of the column value.
| [in] | column | position of the column to return |
Definition at line 196 of file Statement.h.
|
inlinenoexceptinherited |
Returns the size in bytes of the column value.
| [in] | name | name of the column to return |
Definition at line 205 of file Statement.h.
|
inlineinherited |
Returns the position of a column with the specified name.
| SQLiteXXException | if no column with specified name was found |
Definition at line 261 of file Statement.h.
|
inlinenoexceptinherited |
Returns the name assigned to a particular column.
| [in] | index | the position of the column |
Definition at line 243 of file Statement.h.
|
inlinenoexceptinherited |
Returns the name assigned to a particular column.
| [in] | index | the position of the column |
Definition at line 252 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a double.
| [in] | column | position of the column to return |
Definition at line 97 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a double.
| [in] | name | name of the column to return |
Definition at line 106 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as an integer.
| [in] | column | position of the column to return |
Definition at line 40 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as an integer.
| [in] | name | name of the column to return |
Definition at line 49 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a 64-bit integer.
| [in] | column | position of the column to return |
Definition at line 59 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a 64-bit integer.
| [in] | name | name of the column to return |
Definition at line 68 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a string.
| [in] | column | position of the column to return |
Definition at line 136 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a string.
| [in] | name | name of the column to return |
Definition at line 146 of file Statement.h.
|
inlinenoexceptinherited |
Returns the type of the specified column.
| [in] | column | position of the column to return |
Definition at line 215 of file Statement.h.
|
inlinenoexceptinherited |
Returns the type of the specified column.
| [in] | name | name of the column to return |
Definition at line 224 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a UTF-16 string.
| [in] | column | position of the column to return |
Definition at line 156 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a UTF-16 string.
| [in] | name | name of the column to return |
Definition at line 166 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as an unsigned integer.
| [in] | column | position of the column to return |
Definition at line 78 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as an unsigned integer.
| [in] | name | name of the column to return |
Definition at line 87 of file Statement.h.
|
inlinenoexceptinherited |
Returns the specified column value as a value object.
| [in] | column | position of the column to return |
Definition at line 176 of file Statement.h.
|
inlineinherited |
Returns the specified column value as a value object.
| [in] | name | name of the column to return |
Definition at line 185 of file Statement.h.
|
noexcept |
Returns pointer to the underlying "sqlite3_stmt" object.
The returned sqlite3_stmt object pointer will be automatically deleted on the destruction of the parent statement object.
Definition at line 32 of file Statement.cpp.
|
noexcept |
Used to specify if the statement object has a prepared SQLite statement.
Definition at line 25 of file Statement.cpp.
|
inline |
Turn an SQL query into byte code.
| [in] | connection | a successfully opened database connection |
| [in] | text | the statement to be compiled, encoded as UTF-8 |
| [in] | values | possible bindings |
Definition at line 408 of file Statement.h.
|
inline |
Turn an SQL query into byte code.
| [in] | connection | a successfully opened database connection |
| [in] | text | the statement to be compiled, encoded as UTF-16 |
| [in] | values | possible bindings |
Definition at line 422 of file Statement.h.
|
inline |
Resets a prepared statement object back to its initial state.
Any SQL statment parameters that had values bound to them using the bind method return their values. Use clearBindings to reset the bindings.
Definition at line 535 of file Statement.h.
| bool sqlite::statement::step | ( | ) | const |
Evaluates a prepared statement.
This method can be called one or more times to evaluate the statement.
| sqlite::exception | or a derived class |
Definition at line 37 of file Statement.cpp.
1.8.6