|
wxSQLite3
5.0.1
|
Result set of a SQL query. More...
#include <wxsqlite3.h>
Classes | |
| class | Iterator |
| Iterator API. More... | |
Public Member Functions | |
| ResultSet () | |
| Constructor. | |
| ResultSet (DatabaseHandlePtr db, StatementHandlePtr stmt, bool eof, bool first=true) | |
| Constructor for internal use. | |
| ResultSet (const ResultSet &)=default | |
| ResultSet & | operator= (const ResultSet &)=default |
| ResultSet (ResultSet &&)=default | |
| ResultSet & | operator= (ResultSet &&)=default |
| virtual | ~ResultSet () |
| Destructor. | |
| int | GetColumnCount () const |
| Get the number of columns in the result set. | |
| int | FindColumnIndex (const wxString &columnName) const |
| Find the index of a column by name. | |
| wxString | GetColumnName (int columnIndex) const |
| Get the name of a column. | |
| wxString | GetDeclaredColumnType (int columnIndex) const |
| Get the declared type of a column. | |
| int | GetColumnType (int columnIndex) const |
| Get the actual type of a column. | |
| wxString | GetDatabaseName (int columnIndex) const |
| Get the database name of a column. | |
| wxString | GetTableName (int columnIndex) const |
| Get the table name of a column. | |
| wxString | GetOriginName (int columnIndex) const |
| Get the origin name of a column. | |
| wxString | GetAsString (int columnIndex) const |
| Get a column as a string using the column index. | |
| wxString | GetAsString (const wxString &columnName) const |
| Get a column as a string using the column name. | |
| int | GetInt (int columnIndex, int nullValue=0) const |
| Get a column as an integer using the column index. | |
| int | GetInt (const wxString &columnName, int nullValue=0) const |
| Get a column as an integer using the column name. | |
| wxLongLong | GetInt64 (int columnIndex, wxLongLong nullValue=0) const |
| Get a column as a 64-bit integer using the column index. | |
| wxLongLong | GetInt64 (const wxString &columnName, wxLongLong nullValue=0) const |
| Get a column as a 64-bit integer using the column name. | |
| double | GetDouble (int columnIndex, double nullValue=0.0) const |
| Get a column as a double using the column index. | |
| double | GetDouble (const wxString &columnName, double nullValue=0.0) const |
| Get a column as a double using the column name. | |
| wxString | GetString (int columnIndex, const wxString &nullValue=wxEmptyString) const |
| Get a column as a string using the column index. | |
| wxString | GetString (const wxString &columnName, const wxString &nullValue=wxEmptyString) const |
| Get a column as a string using the column name. | |
| const unsigned char * | GetBlob (int columnIndex, int &len) const |
| Get a column as a BLOB using the column index. | |
| const unsigned char * | GetBlob (const wxString &columnName, int &len) const |
| Get a column as a BLOB using the column name. | |
| wxMemoryBuffer & | GetBlob (int columnIndex, wxMemoryBuffer &buffer) const |
| Get a column as a BLOB using the column index and append to memory buffer. | |
| wxMemoryBuffer & | GetBlob (const wxString &columnName, wxMemoryBuffer &buffer) const |
| Get a column as a BLOB using the column index and append to memory buffer. | |
| wxDateTime | GetDate (int columnIndex) const |
| Get a column as a date value using the column index. | |
| wxDateTime | GetDate (const wxString &columnName) const |
| Get a column as a date value using the column name. | |
| wxDateTime | GetTime (int columnIndex) const |
| Get a column as a time value using the column index. | |
| wxDateTime | GetTime (const wxString &columnName) const |
| Get a column as a time value using the column name. | |
| wxDateTime | GetDateTime (int columnIndex) const |
| Get a column as a date and time value using the column index. | |
| wxDateTime | GetDateTime (const wxString &columnName) const |
| Get a column as a date and time value using the column name. | |
| wxDateTime | GetTimestamp (int columnIndex) const |
| Get a column as a timestamp value using the column index. | |
| wxDateTime | GetTimestamp (const wxString &columnName) const |
| Get a column as a timestamp value using the column name. | |
| wxDateTime | GetNumericDateTime (int columnIndex) const |
| Get a column as a date and time value using the column index. | |
| wxDateTime | GetNumericDateTime (const wxString &columnName) const |
| Get a column as a date and time value using the column name. | |
| wxDateTime | GetUnixDateTime (int columnIndex) const |
| Get a column as a date and time value using the column index. | |
| wxDateTime | GetUnixDateTime (const wxString &columnName) const |
| Get a column as a date and time value using the column name. | |
| wxDateTime | GetJulianDayNumber (int columnIndex) const |
| Get a column as a date and time value using the column index. | |
| wxDateTime | GetJulianDayNumber (const wxString &columnName) const |
| Get a column as a date and time value using the column name. | |
| wxDateTime | GetAutomaticDateTime (int columnIndex, bool milliSeconds=false) const |
| Get a column as a date and time value using the column index. | |
| wxDateTime | GetAutomaticDateTime (const wxString &columnName, bool milliSeconds=false) const |
| Get a column as a date and time value using the column name. | |
| bool | GetBool (int columnIndex) const |
| Get a column as a boolean value using the column index. | |
| bool | GetBool (const wxString &columnName) const |
| Get a column as a boolean value using the column name. | |
| bool | IsNull (int columnIndex) const |
| Check whether a column has a NULL value using the column index. | |
| bool | IsNull (const wxString &columnName) const |
| Check whether a column has a NULL value using the column name. | |
| bool | Eof () const |
| Check whether all rows of the result set have been processed. | |
| bool | CursorMoved () const |
| Check whether the cursor has been moved. | |
| bool | NextRow () |
| Retrieve next row of the result set. | |
| void | Finalize () |
| Finalize the result set. | |
| wxString | GetSQL () const |
| Get the original SQL string for preparing the query statement. | |
| wxString | GetExpandedSQL () const |
| Get the original SQL string for preparing the query statement with expanded bound parameters. | |
| bool | IsOk () const |
| Validate associated SQLite database and statement. | |
| Iterator | begin () |
| Retrieve a result set iterator pointing to the first row. | |
| Iterator | end () |
| Retrieve a result set iterator pointing to the last row. | |
| template<typename T> | |
| std::optional< T > | Get (int columnIndex) const |
| Get a column as a std::optional value using the column index. | |
| template<typename... T> | |
| std::tuple< std::optional< T >... > | GetTuple () const |
| Get values from a row of a result set as a tuple of values. | |
| template<typename... T> | |
| std::tuple< std::optional< T >... > | GetTuple (const std::array< int, sizeof...(T)> &columns) const |
| Get values from selected columns of the current row of a result set as a tuple of values. | |
Result set of a SQL query.
| wxSQLite3::ResultSet::ResultSet | ( | ) |
Constructor.
| wxSQLite3::ResultSet::ResultSet | ( | DatabaseHandlePtr | db, |
| StatementHandlePtr | stmt, | ||
| bool | eof, | ||
| bool | first = true ) |
Constructor for internal use.
|
default |
|
default |
|
virtual |
Destructor.
|
inline |
Retrieve a result set iterator pointing to the first row.
| bool wxSQLite3::ResultSet::CursorMoved | ( | ) | const |
Check whether the cursor has been moved.
|
inline |
Retrieve a result set iterator pointing to the last row.
| bool wxSQLite3::ResultSet::Eof | ( | ) | const |
Check whether all rows of the result set have been processed.
| void wxSQLite3::ResultSet::Finalize | ( | ) |
Finalize the result set.
| int wxSQLite3::ResultSet::FindColumnIndex | ( | const wxString & | columnName | ) | const |
Find the index of a column by name.
| columnName | name of the column |
|
inline |
Get a column as a std::optional value using the column index.
The column value is retrieved using the type template parameter. Supported types: int, wxLongLong, double, wxString, wxDateTime, and bool.
| columnIndex | index of the column. Indices start with 0. |
| wxString wxSQLite3::ResultSet::GetAsString | ( | const wxString & | columnName | ) | const |
Get a column as a string using the column name.
| columnName | name of the column |
| wxString wxSQLite3::ResultSet::GetAsString | ( | int | columnIndex | ) | const |
Get a column as a string using the column index.
| columnIndex | index of the column. Indices start with 0. |
| wxDateTime wxSQLite3::ResultSet::GetAutomaticDateTime | ( | const wxString & | columnName, |
| bool | milliSeconds = false ) const |
Get a column as a date and time value using the column name.
The date/time value is interpreted based on the type of column value.
| columnName | name of the column |
| milliSeconds | interpret integer value as milliseconds since 1970-01-01, default: false |
| wxDateTime wxSQLite3::ResultSet::GetAutomaticDateTime | ( | int | columnIndex, |
| bool | milliSeconds = false ) const |
Get a column as a date and time value using the column index.
The date/time value is interpreted based on the type of column value.
| columnIndex | index of the column. Indices start with 0. |
| milliSeconds | interpret integer value as milliseconds since 1970-01-01, default: false |
| const unsigned char * wxSQLite3::ResultSet::GetBlob | ( | const wxString & | columnName, |
| int & | len ) const |
Get a column as a BLOB using the column name.
| columnName | name of the column | |
| [out] | len | length of the blob in bytes |
| wxMemoryBuffer & wxSQLite3::ResultSet::GetBlob | ( | const wxString & | columnName, |
| wxMemoryBuffer & | buffer ) const |
Get a column as a BLOB using the column index and append to memory buffer.
| columnName | name of the column | |
| [out] | buffer | the memory buffer to which the BLOB value is appended |
| const unsigned char * wxSQLite3::ResultSet::GetBlob | ( | int | columnIndex, |
| int & | len ) const |
Get a column as a BLOB using the column index.
| columnIndex | index of the column. Indices start with 0. | |
| [out] | len | length of the blob in bytes |
| wxMemoryBuffer & wxSQLite3::ResultSet::GetBlob | ( | int | columnIndex, |
| wxMemoryBuffer & | buffer ) const |
Get a column as a BLOB using the column index and append to memory buffer.
| columnIndex | index of the column. Indices start with 0. | |
| [out] | buffer | the memory buffer to which the BLOB value is appended |
| bool wxSQLite3::ResultSet::GetBool | ( | const wxString & | columnName | ) | const |
Get a column as a boolean value using the column name.
| columnName | name of the column |
| bool wxSQLite3::ResultSet::GetBool | ( | int | columnIndex | ) | const |
Get a column as a boolean value using the column index.
| columnIndex | index of the column. Indices start with 0. |
| int wxSQLite3::ResultSet::GetColumnCount | ( | ) | const |
Get the number of columns in the result set.
| wxString wxSQLite3::ResultSet::GetColumnName | ( | int | columnIndex | ) | const |
Get the name of a column.
| columnIndex | index of the column. Indices start with 0. |
| int wxSQLite3::ResultSet::GetColumnType | ( | int | columnIndex | ) | const |
Get the actual type of a column.
| columnIndex | index of the column. Indices start with 0. |
| wxString wxSQLite3::ResultSet::GetDatabaseName | ( | int | columnIndex | ) | const |
Get the database name of a column.
| columnIndex | index of the column. Indices start with 0. |
This method is only available if SQLite has been compiled with SQLITE_ENABLE_COLUMN_METADATA defined.
| wxDateTime wxSQLite3::ResultSet::GetDate | ( | const wxString & | columnName | ) | const |
Get a column as a date value using the column name.
Date value is expected to be in format 'YYYY-MM-DD'.
| columnName | name of the column |
| wxDateTime wxSQLite3::ResultSet::GetDate | ( | int | columnIndex | ) | const |
Get a column as a date value using the column index.
Date value is expected to be in format 'YYYY-MM-DD'.
| columnIndex | index of the column. Indices start with 0. |
| wxDateTime wxSQLite3::ResultSet::GetDateTime | ( | const wxString & | columnName | ) | const |
Get a column as a date and time value using the column name.
Date value is expected to be in format 'YYYY-MM-DD HH:MM:SS'.
| columnName | name of the column |
| wxDateTime wxSQLite3::ResultSet::GetDateTime | ( | int | columnIndex | ) | const |
Get a column as a date and time value using the column index.
Date value is expected to be in format 'YYYY-MM-DD HH:MM:SS'.
| columnIndex | index of the column. Indices start with 0. |
| wxString wxSQLite3::ResultSet::GetDeclaredColumnType | ( | int | columnIndex | ) | const |
Get the declared type of a column.
| columnIndex | index of the column. Indices start with 0. |
| double wxSQLite3::ResultSet::GetDouble | ( | const wxString & | columnName, |
| double | nullValue = 0.0 ) const |
Get a column as a double using the column name.
| columnName | name of the column |
| nullValue | value to be returned in case the column is NULL |
| double wxSQLite3::ResultSet::GetDouble | ( | int | columnIndex, |
| double | nullValue = 0.0 ) const |
Get a column as a double using the column index.
| columnIndex | index of the column. Indices start with 0. |
| nullValue | value to be returned in case the column is NULL |
| wxString wxSQLite3::ResultSet::GetExpandedSQL | ( | ) | const |
Get the original SQL string for preparing the query statement with expanded bound parameters.
| int wxSQLite3::ResultSet::GetInt | ( | const wxString & | columnName, |
| int | nullValue = 0 ) const |
Get a column as an integer using the column name.
| columnName | name of the column |
| nullValue | value to be returned in case the column is NULL |
| int wxSQLite3::ResultSet::GetInt | ( | int | columnIndex, |
| int | nullValue = 0 ) const |
Get a column as an integer using the column index.
| columnIndex | index of the column. Indices start with 0. |
| nullValue | value to be returned in case the column is NULL |
| wxLongLong wxSQLite3::ResultSet::GetInt64 | ( | const wxString & | columnName, |
| wxLongLong | nullValue = 0 ) const |
Get a column as a 64-bit integer using the column name.
| columnName | name of the column |
| nullValue | value to be returned in case the column is NULL |
| wxLongLong wxSQLite3::ResultSet::GetInt64 | ( | int | columnIndex, |
| wxLongLong | nullValue = 0 ) const |
Get a column as a 64-bit integer using the column index.
| columnIndex | index of the column. Indices start with 0. |
| nullValue | value to be returned in case the column is NULL |
| wxDateTime wxSQLite3::ResultSet::GetJulianDayNumber | ( | const wxString & | columnName | ) | const |
Get a column as a date and time value using the column name.
The date/time value is expected to be stored in the database as a Julian Day Number (i.e. double).
| columnName | name of the column |
| wxDateTime wxSQLite3::ResultSet::GetJulianDayNumber | ( | int | columnIndex | ) | const |
Get a column as a date and time value using the column index.
The date/time value is expected to be stored in the database as a Julian Day Number (i.e. double).
| columnIndex | index of the column. Indices start with 0. |
| wxDateTime wxSQLite3::ResultSet::GetNumericDateTime | ( | const wxString & | columnName | ) | const |
Get a column as a date and time value using the column name.
The date/time value is expected to be stored in the database as a numeric value (i.e. int64), measured in milliseconds since 1970-01-01.
| columnName | name of the column |
| wxDateTime wxSQLite3::ResultSet::GetNumericDateTime | ( | int | columnIndex | ) | const |
Get a column as a date and time value using the column index.
The date/time value is expected to be stored in the database as a numeric value (i.e. int64), measured in milliseconds since 1970-01-01.
| columnIndex | index of the column. Indices start with 0. |
| wxString wxSQLite3::ResultSet::GetOriginName | ( | int | columnIndex | ) | const |
Get the origin name of a column.
| columnIndex | index of the column. Indices start with 0. |
This method is only available if SQLite has been compiled with SQLITE_ENABLE_COLUMN_METADATA defined.
| wxString wxSQLite3::ResultSet::GetSQL | ( | ) | const |
Get the original SQL string for preparing the query statement.
| wxString wxSQLite3::ResultSet::GetString | ( | const wxString & | columnName, |
| const wxString & | nullValue = wxEmptyString ) const |
Get a column as a string using the column name.
| columnName | name of the column |
| nullValue | value to be returned in case the column is NULL |
| wxString wxSQLite3::ResultSet::GetString | ( | int | columnIndex, |
| const wxString & | nullValue = wxEmptyString ) const |
Get a column as a string using the column index.
| columnIndex | index of the column. Indices start with 0. |
| nullValue | value to be returned in case the column is NULL |
| wxString wxSQLite3::ResultSet::GetTableName | ( | int | columnIndex | ) | const |
Get the table name of a column.
| columnIndex | index of the column. Indices start with 0. |
This method is only available if SQLite has been compiled with SQLITE_ENABLE_COLUMN_METADATA defined.
| wxDateTime wxSQLite3::ResultSet::GetTime | ( | const wxString & | columnName | ) | const |
Get a column as a time value using the column name.
Date value is expected to be in format 'HH:MM:SS'.
| columnName | name of the column |
| wxDateTime wxSQLite3::ResultSet::GetTime | ( | int | columnIndex | ) | const |
Get a column as a time value using the column index.
Date value is expected to be in format 'HH:MM:SS'.
| columnIndex | index of the column. Indices start with 0. |
| wxDateTime wxSQLite3::ResultSet::GetTimestamp | ( | const wxString & | columnName | ) | const |
Get a column as a timestamp value using the column name.
Date value is expected to be in format 'YYYY-MM-DD HH:MM:SS.mmm'.
| columnName | name of the column |
| wxDateTime wxSQLite3::ResultSet::GetTimestamp | ( | int | columnIndex | ) | const |
Get a column as a timestamp value using the column index.
Date value is expected to be in format 'YYYY-MM-DD HH:MM:SS.mmm'.
| columnIndex | index of the column. Indices start with 0. |
|
inline |
Get values from a row of a result set as a tuple of values.
The specified type template parameters determine the number and types of the columns to retrieve from the current row of a result set. Supported types: int, wxLongLong, double, wxString, wxDateTime, and bool.
|
inline |
Get values from selected columns of the current row of a result set as a tuple of values.
The specified type template parameters determine the number and types of the columns to retrieve from the current row of a result set. Supported types: int, wxLongLong, double, wxString, wxDateTime, and bool.
| columns | an array of 0-based column indices |
| wxDateTime wxSQLite3::ResultSet::GetUnixDateTime | ( | const wxString & | columnName | ) | const |
Get a column as a date and time value using the column name.
The date/time value is expected to be stored in the database as an integer value (i.e. int64), measured in seconds since 1970-01-01.
| columnName | name of the column |
| wxDateTime wxSQLite3::ResultSet::GetUnixDateTime | ( | int | columnIndex | ) | const |
Get a column as a date and time value using the column index.
The date/time value is expected to be stored in the database as an integer value (i.e. int64), measured in seconds since 1970-01-01.
| columnIndex | index of the column. Indices start with 0. |
| bool wxSQLite3::ResultSet::IsNull | ( | const wxString & | columnName | ) | const |
Check whether a column has a NULL value using the column name.
| columnName | name of the column |
| bool wxSQLite3::ResultSet::IsNull | ( | int | columnIndex | ) | const |
Check whether a column has a NULL value using the column index.
| columnIndex | index of the column. Indices start with 0. |
| bool wxSQLite3::ResultSet::IsOk | ( | ) | const |
Validate associated SQLite database and statement.
| bool wxSQLite3::ResultSet::NextRow | ( | ) |
Retrieve next row of the result set.
Advances the cursor to the next row. On creation of the result set the cursor is positioned BEFORE the first row, i.e. the first call to this method makes the first row available for processing.