|
wxSQLite3
5.0.1
|
Represents a prepared SQL statement. More...
#include <wxsqlite3.h>
Public Member Functions | |
| Statement () | |
| Constructor. | |
| Statement (DatabaseHandlePtr db, StatementHandlePtr stmt) | |
| Constructor (internal use only). | |
| Statement (const Statement &)=default | |
| Statement & | operator= (const Statement &)=default |
| Statement (Statement &&)=default | |
| Statement & | operator= (Statement &&)=default |
| virtual | ~Statement () |
| Destructor. | |
| int | ExecuteUpdate () |
| Execute the database update represented by this statement. | |
| ResultSet | ExecuteQuery () |
| Execute the query represented by this statement. | |
| int | ExecuteScalar () |
| Execute a scalar SQL query statement given as a wxString. | |
| int | GetParamCount () const |
| Get the number of statement parameters. | |
| int | GetParamIndex (const wxString ¶mName) const |
| Get the index of a parameter with a given name. | |
| wxString | GetParamName (int paramIndex) const |
| Get the name of a paramater at the given position. | |
| void | Bind (int paramIndex, const wxString &stringValue) |
| Bind parameter to a string value. | |
| void | Bind (int paramIndex, int intValue) |
| Bind parameter to a integer value. | |
| void | Bind (int paramIndex, wxLongLong int64Value) |
| Bind parameter to a 64-bit integer value. | |
| void | Bind (int paramIndex, double doubleValue) |
| Bind parameter to a double value. | |
| void | Bind (int paramIndex, const char *charValue) |
| Bind parameter to a utf-8 character string value. | |
| void | Bind (int paramIndex, const unsigned char *blobValue, int blobLen) |
| Bind parameter to a BLOB value. | |
| void | Bind (int paramIndex, const wxMemoryBuffer &blobValue) |
| Bind parameter to a BLOB value. | |
| void | Bind (int paramIndex, void *pointer, const wxString &pointerType, void(*DeletePointer)(void *)=nullptr) |
| Bind parameter to a pointer value. | |
| void | BindDate (int paramIndex, const wxDateTime &date) |
| Bind parameter to a date value. | |
| void | BindTime (int paramIndex, const wxDateTime &time) |
| Bind parameter to a time value. | |
| void | BindDateTime (int paramIndex, const wxDateTime &datetime) |
| Bind parameter to a date and time value. | |
| void | BindTimestamp (int paramIndex, const wxDateTime ×tamp) |
| Bind parameter to a timestamp value. | |
| void | BindNumericDateTime (int paramIndex, const wxDateTime &datetime) |
| Bind parameter to a date and time value. | |
| void | BindUnixDateTime (int paramIndex, const wxDateTime &datetime) |
| Bind parameter to a date and time value. | |
| void | BindJulianDayNumber (int paramIndex, const wxDateTime &datetime) |
| Bind parameter to a date and time value. | |
| void | BindBool (int paramIndex, bool value) |
| Bind parameter to a boolean value. | |
| void | BindNull (int paramIndex) |
| Bind parameter to a NULL value. | |
| void | BindZeroBlob (int paramIndex, int blobSize) |
| Bind parameter to a Zero BLOB value. | |
| void | ClearBindings () |
| Clear all parameter bindings. | |
| wxString | GetSQL () const |
| Get the original SQL string for the prepared statement. | |
| wxString | GetExpandedSQL () const |
| Get the original SQL string for the prepared statement with expanded bound parameters. | |
| void | Reset () |
| Reset the prepared statement. | |
| bool | IsReadOnly () const |
| Determine whether the statement is read-only. | |
| void | Finalize () |
| Finalize the prepared statement. | |
| bool | IsOk () const |
| Validate associated SQLite database and statement. | |
| bool | IsBusy () const |
| Determine if a prepared statement has been reset. | |
| int | Status (StatementStatus opCode, bool resetFlag=false) const |
| Determine internal operation counters of the underlying prepared statement. | |
| template<typename T> | |
| void | Bind (int paramIndex, std::optional< T > const &value) |
| Bind a std::optional value to a placeholder in the statement. | |
| template<typename... T> | |
| void | BindTuple (std::tuple< T... > const &values) |
| Bind a tuple of parameters with specified types to placeholders in the statement. | |
| template<typename... T> | |
| void | BindTuple (const std::tuple< T... > &values, const std::array< int, sizeof...(T)> ¶mIndices) |
| Bind a tuple of parameters with specified types to placeholders in the statement. | |
Represents a prepared SQL statement.
| wxSQLite3::Statement::Statement | ( | ) |
Constructor.
| wxSQLite3::Statement::Statement | ( | DatabaseHandlePtr | db, |
| StatementHandlePtr | stmt ) |
Constructor (internal use only).
|
default |
|
default |
|
virtual |
Destructor.
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| const char * | charValue ) |
Bind parameter to a utf-8 character string value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| charValue | value of the parameter |
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| const unsigned char * | blobValue, | ||
| int | blobLen ) |
Bind parameter to a BLOB value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| blobValue | value of the parameter |
| blobLen | length of the blob in bytes |
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| const wxMemoryBuffer & | blobValue ) |
Bind parameter to a BLOB value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| blobValue | value of the parameter |
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| const wxString & | stringValue ) |
Bind parameter to a string value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| stringValue | value of the parameter |
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| double | doubleValue ) |
Bind parameter to a double value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| doubleValue | value of the parameter |
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| int | intValue ) |
Bind parameter to a integer value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| intValue | value of the parameter |
|
inline |
Bind a std::optional value to a placeholder in the statement.
The specified type template parameter determines the type of the value. The value can be std::nullopt representing a SQL NULL value. Supported types: int, wxLongLong, double, wxString, wxDateTime, and bool.
| paramIndex | index of the column. Indices start with 1. |
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| void * | pointer, | ||
| const wxString & | pointerType, | ||
| void(* | DeletePointer )(void *) = nullptr ) |
Bind parameter to a pointer value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| pointer | pointer value of the parameter |
| pointerType | descriptive name of the pointer type as expected by the extension module |
| DeletePointer | pointer to a function for deleting the object pointed to by the pointer after use in SQLite (default: NULL) |
| void wxSQLite3::Statement::Bind | ( | int | paramIndex, |
| wxLongLong | int64Value ) |
Bind parameter to a 64-bit integer value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| int64Value | value of the parameter |
| void wxSQLite3::Statement::BindBool | ( | int | paramIndex, |
| bool | value ) |
Bind parameter to a boolean value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| value | value of the parameter |
| void wxSQLite3::Statement::BindDate | ( | int | paramIndex, |
| const wxDateTime & | date ) |
Bind parameter to a date value.
Only the date part is stored in format 'YYYY-MM-DD'.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| date | value of the parameter |
| void wxSQLite3::Statement::BindDateTime | ( | int | paramIndex, |
| const wxDateTime & | datetime ) |
Bind parameter to a date and time value.
Date and time are stored in format 'YYYY-MM-DD HH:MM:SS'.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| datetime | value of the parameter |
| void wxSQLite3::Statement::BindJulianDayNumber | ( | int | paramIndex, |
| const wxDateTime & | datetime ) |
Bind parameter to a date and time value.
The date/time value is transferred to the database as a Julian Day Number value (i.e. double).
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| datetime | value of the parameter |
| void wxSQLite3::Statement::BindNull | ( | int | paramIndex | ) |
Bind parameter to a NULL value.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| void wxSQLite3::Statement::BindNumericDateTime | ( | int | paramIndex, |
| const wxDateTime & | datetime ) |
Bind parameter to a date and time value.
The date/time value is transferred to the database as a numeric value (i.e. int64). The value is measured in milliseconds since 1970-01-01.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| datetime | value of the parameter |
| void wxSQLite3::Statement::BindTime | ( | int | paramIndex, |
| const wxDateTime & | time ) |
Bind parameter to a time value.
Only the time part is stored in format 'HH:MM:SS'.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| time | value of the parameter |
| void wxSQLite3::Statement::BindTimestamp | ( | int | paramIndex, |
| const wxDateTime & | timestamp ) |
Bind parameter to a timestamp value.
Timestamp is stored in format 'YYYY-MM-DD HH:MM:SS.mmm'.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| timestamp | value of the parameter |
|
inline |
Bind a tuple of parameters with specified types to placeholders in the statement.
The specified type template parameters of the tuple determine the number and types of the values to be bound to placeholders in the SQL statement.
| values | Tuple of values, can contain std::nullopt |
| paramIndices | Array of 1-based indices of placeholders to which the tuple members should be bound |
|
inline |
Bind a tuple of parameters with specified types to placeholders in the statement.
The specified type template parameters of the tuple determine the number and types of the values to be bound to placeholders in the SQL statement.
| values | Tuple of values, can contain std::nullopt |
| void wxSQLite3::Statement::BindUnixDateTime | ( | int | paramIndex, |
| const wxDateTime & | datetime ) |
Bind parameter to a date and time value.
The date/time value is transferred to the database as an integer value. The value is measured in seconds since 1970-01-01.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| datetime | value of the parameter |
| void wxSQLite3::Statement::BindZeroBlob | ( | int | paramIndex, |
| int | blobSize ) |
Bind parameter to a Zero BLOB value.
Space for a BLOB is reserved and filled with binary zeros for later reference through a BLOB handle.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| blobSize | size of the BLOB |
| void wxSQLite3::Statement::ClearBindings | ( | ) |
Clear all parameter bindings.
Sets all the parameters in the prepared SQL statement back to NULL.
| ResultSet wxSQLite3::Statement::ExecuteQuery | ( | ) |
Execute the query represented by this statement.
| int wxSQLite3::Statement::ExecuteScalar | ( | ) |
Execute a scalar SQL query statement given as a wxString.
Allows to easily retrieve the result of queries returning a single integer result like SELECT COUNT(*) FROM table WHERE condition.
| int wxSQLite3::Statement::ExecuteUpdate | ( | ) |
Execute the database update represented by this statement.
| void wxSQLite3::Statement::Finalize | ( | ) |
Finalize the prepared statement.
| wxString wxSQLite3::Statement::GetExpandedSQL | ( | ) | const |
Get the original SQL string for the prepared statement with expanded bound parameters.
| int wxSQLite3::Statement::GetParamCount | ( | ) | const |
Get the number of statement parameters.
| int wxSQLite3::Statement::GetParamIndex | ( | const wxString & | paramName | ) | const |
Get the index of a parameter with a given name.
| paramName |
| wxString wxSQLite3::Statement::GetParamName | ( | int | paramIndex | ) | const |
Get the name of a paramater at the given position.
| paramIndex | index of the parameter. The first parameter has an index of 1. |
| wxString wxSQLite3::Statement::GetSQL | ( | ) | const |
Get the original SQL string for the prepared statement.
| bool wxSQLite3::Statement::IsBusy | ( | ) | const |
Determine if a prepared statement has been reset.
| bool wxSQLite3::Statement::IsOk | ( | ) | const |
Validate associated SQLite database and statement.
| bool wxSQLite3::Statement::IsReadOnly | ( | ) | const |
Determine whether the statement is read-only.
| void wxSQLite3::Statement::Reset | ( | ) |
Reset the prepared statement.
Resets the statement back to it's initial state, ready to be re-executed. Any SQL statement variables that had values bound to them retain their values.
| int wxSQLite3::Statement::Status | ( | StatementStatus | opCode, |
| bool | resetFlag = false ) const |
Determine internal operation counters of the underlying prepared statement.
Prepared statements maintain various counters to measure the performance of specific operations. This method allows to monitor the performance characteristics of the prepared statement.
| opCode | operation code of the operation to be queried |
| resetFlag | flag whether the associated counter should be reset to zero (default: false) |