wxSQLite3: wxSQLite3ResultSet Class Reference

wxSQLite3 3.0.6

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
wxSQLite3ResultSet Class Reference

Result set of a SQL query. More...

`#include <wxsqlite3.h>`

## Public Member Functions
| wxSQLite3ResultSet ()
| Constructor. More...
| wxSQLite3ResultSet (const wxSQLite3ResultSet &resultSet)
| Copy constructor. More...
| wxSQLite3ResultSet (wxSQLite3DatabaseReference *db, wxSQLite3StatementReference *stmt, bool eof, bool first=true)
| Constructor for internal use. More...
wxSQLite3ResultSet & | operator= (const wxSQLite3ResultSet &resultSet)
| Assignment constructor. More...
virtual | ~wxSQLite3ResultSet ()
| Destructor. More...
int | GetColumnCount ()
| Get the number of columns in the result set. More...
int | FindColumnIndex (const wxString &columnName)
| Find the index of a column by name. More...
wxString | GetColumnName (int columnIndex)
| Get the name of a column. More...
wxString | GetDeclaredColumnType (int columnIndex)
| Get the declared type of a column. More...
int | GetColumnType (int columnIndex)
| Get the actual type of a column. More...
wxString | GetDatabaseName (int columnIndex)
| Get the database name of a column. More...
wxString | GetTableName (int columnIndex)
| Get the table name of a column. More...
wxString | GetOriginName (int columnIndex)
| Get the origin name of a column. More...
wxString | GetAsString (int columnIndex)
| Get a column as a string using the column index. More...
wxString | GetAsString (const wxString &columnName)
| Get a column as a string using the column name. More...
int | GetInt (int columnIndex, int nullValue=0)
| Get a column as an integer using the column index. More...
int | GetInt (const wxString &columnName, int nullValue=0)
| Get a column as an integer using the column name. More...
wxLongLong | GetInt64 (int columnIndex, wxLongLong nullValue=0)
| Get a column as a 64-bit integer using the column index. More...
wxLongLong | GetInt64 (const wxString &columnName, wxLongLong nullValue=0)
| Get a column as a 64-bit integer using the column name. More...
double | GetDouble (int columnIndex, double nullValue=0.0)
| Get a column as a double using the column index. More...
double | GetDouble (const wxString &columnName, double nullValue=0.0)
| Get a column as a double using the column name. More...
wxString | GetString (int columnIndex, const wxString &nullValue=wxEmptyString)
| Get a column as a string using the column index. More...
wxString | GetString (const wxString &columnName, const wxString &nullValue=wxEmptyString)
| Get a column as a string using the column name. More...
const unsigned char * | GetBlob (int columnIndex, int &len)
| Get a column as a BLOB using the column index. More...
const unsigned char * | GetBlob (const wxString &columnName, int &len)
| Get a column as a BLOB using the column name. More...
wxMemoryBuffer & | GetBlob (int columnIndex, wxMemoryBuffer &buffer)
| Get a column as a BLOB using the column index and append to memory buffer. More...
wxMemoryBuffer & | GetBlob (const wxString &columnName, wxMemoryBuffer &buffer)
| Get a column as a BLOB using the column index and append to memory buffer. More...
wxDateTime | GetDate (int columnIndex)
| Get a column as a date value using the column index. More...
wxDateTime | GetDate (const wxString &columnName)
| Get a column as a date value using the column name. More...
wxDateTime | GetTime (int columnIndex)
| Get a column as a time value using the column index. More...
wxDateTime | GetTime (const wxString &columnName)
| Get a column as a time value using the column name. More...
wxDateTime | GetDateTime (int columnIndex)
| Get a column as a date and time value using the column index. More...
wxDateTime | GetDateTime (const wxString &columnName)
| Get a column as a date and time value using the column name. More...
wxDateTime | GetTimestamp (int columnIndex)
| Get a column as a timestamp value using the column index. More...
wxDateTime | GetTimestamp (const wxString &columnName)
| Get a column as a timestamp value using the column name. More...
wxDateTime | GetNumericDateTime (int columnIndex)
| Get a column as a date and time value using the column index. More...
wxDateTime | GetNumericDateTime (const wxString &columnName)
| Get a column as a date and time value using the column name. More...
wxDateTime | GetUnixDateTime (int columnIndex)
| Get a column as a date and time value using the column index. More...
wxDateTime | GetUnixDateTime (const wxString &columnName)
| Get a column as a date and time value using the column name. More...
wxDateTime | GetJulianDayNumber (int columnIndex)
| Get a column as a date and time value using the column index. More...
wxDateTime | GetJulianDayNumber (const wxString &columnName)
| Get a column as a date and time value using the column name. More...
wxDateTime | GetAutomaticDateTime (int columnIndex, bool milliSeconds=false)
| Get a column as a date and time value using the column index. More...
wxDateTime | GetAutomaticDateTime (const wxString &columnName, bool milliSeconds=false)
| Get a column as a date and time value using the column name. More...
bool | GetBool (int columnIndex)
| Get a column as a boolean value using the column index. More...
bool | GetBool (const wxString &columnName)
| Get a column as a boolean value using the column name. More...
bool | IsNull (int columnIndex)
| Check whether a column has a NULL value using the column index. More...
bool | IsNull (const wxString &columnName)
| Check whether a column has a NULL value using the column name. More...
bool | Eof ()
| Check whether all rows of the result set have been processed. More...
bool | CursorMoved ()
| Check whether the cursor has been moved. More...
bool | NextRow ()
| Retrieve next row of the result set. More...
void | Finalize ()
| Finalize the result set. More...
wxString | GetSQL ()
| Get the original SQL string for preparing the query statement. More...
bool | IsOk ()
| Validate associated SQLite database and statement. More...

## Detailed Description

Result set of a SQL query.

## Constructor & Destructor Documentation

wxSQLite3ResultSet::wxSQLite3ResultSet | ( |  | ) |

Constructor.

wxSQLite3ResultSet::wxSQLite3ResultSet | ( | const wxSQLite3ResultSet & | resultSet | ) |

Copy constructor.

wxSQLite3ResultSet::wxSQLite3ResultSet | ( | wxSQLite3DatabaseReference * | db,
|  | wxSQLite3StatementReference * | stmt,
|  | bool | eof,
|  | bool | first = `true`
| ) |  |

Constructor for internal use.

wxSQLite3ResultSet::~wxSQLite3ResultSet | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

bool wxSQLite3ResultSet::CursorMoved | ( |  | ) |

Check whether the cursor has been moved.

Returns
  TRUE if the cursor has been moved using method NextRow, FALSE otherwise

bool wxSQLite3ResultSet::Eof | ( |  | ) |

Check whether all rows of the result set have been processed.

Returns
  TRUE if all rows of the result have been processed, FALSE otherwise

void wxSQLite3ResultSet::Finalize | ( |  | ) |

Finalize the result set.

int wxSQLite3ResultSet::FindColumnIndex | ( | const wxString & | columnName | ) |

Find the index of a column by name.

Parameters

  columnName | name of the column

Returns
  index of the column. Indices start with 0.

wxString wxSQLite3ResultSet::GetAsString | ( | int | columnIndex | ) |

Get a column as a string using the column index.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column as string

wxString wxSQLite3ResultSet::GetAsString | ( | const wxString & | columnName | ) |

Get a column as a string using the column name.

Parameters

  columnName | name of the column

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetAutomaticDateTime | ( | int | columnIndex,
|  | bool | milliSeconds = `false`
| ) |  |

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.

Parameters

  columnIndex | index of the column. Indices start with 0.
  milliSeconds | interpret integer value as milliseconds since 1970-01-01, default: false

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetAutomaticDateTime | ( | const wxString & | columnName,
|  | bool | milliSeconds = `false`
| ) |  |

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.

Parameters

  columnName | name of the column
  milliSeconds | interpret integer value as milliseconds since 1970-01-01, default: false

Returns
  value of the column

const unsigned char * wxSQLite3ResultSet::GetBlob | ( | int | columnIndex,
|  | int & | len
| ) |  |

Get a column as a BLOB using the column index.

Parameters

  | columnIndex | index of the column. Indices start with 0.
  [out] | len | length of the blob in bytes

Returns
  value of the column

const unsigned char * wxSQLite3ResultSet::GetBlob | ( | const wxString & | columnName,
|  | int & | len
| ) |  |

Get a column as a BLOB using the column name.

Parameters

  | columnName | name of the column
  [out] | len | length of the blob in bytes

Returns
  value of the column

wxMemoryBuffer & wxSQLite3ResultSet::GetBlob | ( | int | columnIndex,
|  | wxMemoryBuffer & | buffer
| ) |  |

Get a column as a BLOB using the column index and append to memory buffer.

Parameters

  | columnIndex | index of the column. Indices start with 0.
  [out] | buffer | the memory buffer to which the BLOB value is appended

Returns
  reference to the memory buffer

wxMemoryBuffer & wxSQLite3ResultSet::GetBlob | ( | const wxString & | columnName,
|  | wxMemoryBuffer & | buffer
| ) |  |

Get a column as a BLOB using the column index and append to memory buffer.

Parameters

  | columnName | name of the column
  [out] | buffer | the memory buffer to which the BLOB value is appended

Returns
  reference to the memory buffer

bool wxSQLite3ResultSet::GetBool | ( | int | columnIndex | ) |

Get a column as a boolean value using the column index.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

bool wxSQLite3ResultSet::GetBool | ( | const wxString & | columnName | ) |

Get a column as a boolean value using the column name.

Parameters

  columnName | name of the column

Returns
  value of the column

int wxSQLite3ResultSet::GetColumnCount | ( |  | ) |

Get the number of columns in the result set.

Returns
  number of columns in result set

wxString wxSQLite3ResultSet::GetColumnName | ( | int | columnIndex | ) |

Get the name of a column.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  column name as string

int wxSQLite3ResultSet::GetColumnType | ( | int | columnIndex | ) |

Get the actual type of a column.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  column type as one of the values WXSQLITE_INTEGER, WXSQLITE_FLOAT, WXSQLITE_TEXT, WXSQLITE_BLOB, or WXSQLITE_NULL

wxString wxSQLite3ResultSet::GetDatabaseName | ( | int | columnIndex | ) |

Get the database name of a column.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  database name the column belongs to or empty string

This method is only available if WXSQLITE3_HAVE_METADATA is defined and SQLite has been compiled with SQLITE_ENABLE_COLUMN_METADATA defined.

wxDateTime wxSQLite3ResultSet::GetDate | ( | int | columnIndex | ) |

Get a column as a date value using the column index.

Date value is expected to be in format 'YYYY-MM-DD'.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetDate | ( | const wxString & | columnName | ) |

Get a column as a date value using the column name.

Date value is expected to be in format 'YYYY-MM-DD'.

Parameters

  columnName | name of the column

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetDateTime | ( | int | columnIndex | ) |

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'.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetDateTime | ( | const wxString & | columnName | ) |

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'.

Parameters

  columnName | name of the column

Returns
  value of the column

wxString wxSQLite3ResultSet::GetDeclaredColumnType | ( | int | columnIndex | ) |

Get the declared type of a column.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  type string as specified in the table definition

double wxSQLite3ResultSet::GetDouble | ( | int | columnIndex,
|  | double | nullValue = `0.0`
| ) |  |

Get a column as a double using the column index.

Parameters

  columnIndex | index of the column. Indices start with 0.
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

double wxSQLite3ResultSet::GetDouble | ( | const wxString & | columnName,
|  | double | nullValue = `0.0`
| ) |  |

Get a column as a double using the column name.

Parameters

  columnName | name of the column
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

int wxSQLite3ResultSet::GetInt | ( | int | columnIndex,
|  | int | nullValue = `0`
| ) |  |

Get a column as an integer using the column index.

Parameters

  columnIndex | index of the column. Indices start with 0.
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

int wxSQLite3ResultSet::GetInt | ( | const wxString & | columnName,
|  | int | nullValue = `0`
| ) |  |

Get a column as an integer using the column name.

Parameters

  columnName | name of the column
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

wxLongLong wxSQLite3ResultSet::GetInt64 | ( | int | columnIndex,
|  | wxLongLong | nullValue = `0`
| ) |  |

Get a column as a 64-bit integer using the column index.

Parameters

  columnIndex | index of the column. Indices start with 0.
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

wxLongLong wxSQLite3ResultSet::GetInt64 | ( | const wxString & | columnName,
|  | wxLongLong | nullValue = `0`
| ) |  |

Get a column as a 64-bit integer using the column name.

Parameters

  columnName | name of the column
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetJulianDayNumber | ( | int | columnIndex | ) |

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).

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetJulianDayNumber | ( | const wxString & | columnName | ) |

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).

Parameters

  columnName | name of the column

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetNumericDateTime | ( | int | columnIndex | ) |

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.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetNumericDateTime | ( | const wxString & | columnName | ) |

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.

Parameters

  columnName | name of the column

Returns
  value of the column

wxString wxSQLite3ResultSet::GetOriginName | ( | int | columnIndex | ) |

Get the origin name of a column.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  origin name the column belongs to or empty string

This method is only available if WXSQLITE3_HAVE_METADATA is defined and SQLite has been compiled with SQLITE_ENABLE_COLUMN_METADATA defined.

wxString wxSQLite3ResultSet::GetSQL | ( |  | ) |

Get the original SQL string for preparing the query statement.

Returns
  the original SQL string used to prepare the query statement

wxString wxSQLite3ResultSet::GetString | ( | int | columnIndex,
|  | const wxString & | nullValue = `wxEmptyString`
| ) |  |

Get a column as a string using the column index.

Parameters

  columnIndex | index of the column. Indices start with 0.
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

wxString wxSQLite3ResultSet::GetString | ( | const wxString & | columnName,
|  | const wxString & | nullValue = `wxEmptyString`
| ) |  |

Get a column as a string using the column name.

Parameters

  columnName | name of the column
  nullValue | value to be returned in case the column is NULL

Returns
  value of the column

wxString wxSQLite3ResultSet::GetTableName | ( | int | columnIndex | ) |

Get the table name of a column.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  table name the column belongs to or empty string

This method is only available if WXSQLITE3_HAVE_METADATA is defined and SQLite has been compiled with SQLITE_ENABLE_COLUMN_METADATA defined.

wxDateTime wxSQLite3ResultSet::GetTime | ( | int | columnIndex | ) |

Get a column as a time value using the column index.

Date value is expected to be in format 'HH:MM:SS'.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetTime | ( | const wxString & | columnName | ) |

Get a column as a time value using the column name.

Date value is expected to be in format 'HH:MM:SS'.

Parameters

  columnName | name of the column

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetTimestamp | ( | int | columnIndex | ) |

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'.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetTimestamp | ( | const wxString & | columnName | ) |

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'.

Parameters

  columnName | name of the column

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetUnixDateTime | ( | int | columnIndex | ) |

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.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  value of the column

wxDateTime wxSQLite3ResultSet::GetUnixDateTime | ( | const wxString & | columnName | ) |

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.

Parameters

  columnName | name of the column

Returns
  value of the column

bool wxSQLite3ResultSet::IsNull | ( | int | columnIndex | ) |

Check whether a column has a NULL value using the column index.

Parameters

  columnIndex | index of the column. Indices start with 0.

Returns
  TRUE if the value is NULL, FALSE otherwise

bool wxSQLite3ResultSet::IsNull | ( | const wxString & | columnName | ) |

Check whether a column has a NULL value using the column name.

Parameters

  columnName | name of the column

Returns
  TRUE if the value is NULL, FALSE otherwise

bool wxSQLite3ResultSet::IsOk | ( |  | ) |

Validate associated SQLite database and statement.

Returns
  TRUE if both, a SQLite database and a SQLite statement, are associated, FALSE otherwise

bool wxSQLite3ResultSet::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.

Returns
  TRUE while there are still rows to process, FALSE otherwise

wxSQLite3ResultSet & wxSQLite3ResultSet::operator= | ( | const wxSQLite3ResultSet & | resultSet | ) |

Assignment constructor.

The documentation for this class was generated from the following files:

- wxsqlite3.h
- wxsqlite3.cpp