wxSQLite3 4.9.12
Loading...
Searching...
No Matches
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.
 
 wxSQLite3ResultSet (const wxSQLite3ResultSet &resultSet)
 Copy constructor.
 
 wxSQLite3ResultSet (wxSQLite3DatabaseReference *db, wxSQLite3StatementReference *stmt, bool eof, bool first=true)
 Constructor for internal use.
 
wxSQLite3ResultSetoperator= (const wxSQLite3ResultSet &resultSet)
 Assignment constructor.
 
virtual ~wxSQLite3ResultSet ()
 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.
 

Detailed Description

Result set of a SQL query.

Constructor & Destructor Documentation

◆ wxSQLite3ResultSet() [1/3]

wxSQLite3ResultSet::wxSQLite3ResultSet ( )

Constructor.

◆ wxSQLite3ResultSet() [2/3]

wxSQLite3ResultSet::wxSQLite3ResultSet ( const wxSQLite3ResultSet & resultSet)

Copy constructor.

◆ wxSQLite3ResultSet() [3/3]

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

Constructor for internal use.

◆ ~wxSQLite3ResultSet()

wxSQLite3ResultSet::~wxSQLite3ResultSet ( )
virtual

Destructor.

Member Function Documentation

◆ CursorMoved()

bool wxSQLite3ResultSet::CursorMoved ( ) const

Check whether the cursor has been moved.

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

◆ Eof()

bool wxSQLite3ResultSet::Eof ( ) const

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

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

◆ Finalize()

void wxSQLite3ResultSet::Finalize ( )

Finalize the result set.

◆ FindColumnIndex()

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

Find the index of a column by name.

Parameters
columnNamename of the column
Returns
index of the column. Indices start with 0.

◆ GetAsString() [1/2]

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

Get a column as a string using the column name.

Parameters
columnNamename of the column
Returns
value of the column

◆ GetAsString() [2/2]

wxString wxSQLite3ResultSet::GetAsString ( int columnIndex) const

Get a column as a string using the column index.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column as string

◆ GetAutomaticDateTime() [1/2]

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

Parameters
columnNamename of the column
milliSecondsinterpret integer value as milliseconds since 1970-01-01, default: false
Returns
value of the column

◆ GetAutomaticDateTime() [2/2]

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

Parameters
columnIndexindex of the column. Indices start with 0.
milliSecondsinterpret integer value as milliseconds since 1970-01-01, default: false
Returns
value of the column

◆ GetBlob() [1/4]

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

Get a column as a BLOB using the column name.

Parameters
columnNamename of the column
[out]lenlength of the blob in bytes
Returns
value of the column

◆ GetBlob() [2/4]

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

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

Parameters
columnNamename of the column
[out]bufferthe memory buffer to which the BLOB value is appended
Returns
reference to the memory buffer

◆ GetBlob() [3/4]

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

Get a column as a BLOB using the column index.

Parameters
columnIndexindex of the column. Indices start with 0.
[out]lenlength of the blob in bytes
Returns
value of the column

◆ GetBlob() [4/4]

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

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

Parameters
columnIndexindex of the column. Indices start with 0.
[out]bufferthe memory buffer to which the BLOB value is appended
Returns
reference to the memory buffer

◆ GetBool() [1/2]

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

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

Parameters
columnNamename of the column
Returns
value of the column

◆ GetBool() [2/2]

bool wxSQLite3ResultSet::GetBool ( int columnIndex) const

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

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ GetColumnCount()

int wxSQLite3ResultSet::GetColumnCount ( ) const

Get the number of columns in the result set.

Returns
number of columns in result set

◆ GetColumnName()

wxString wxSQLite3ResultSet::GetColumnName ( int columnIndex) const

Get the name of a column.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
column name as string

◆ GetColumnType()

int wxSQLite3ResultSet::GetColumnType ( int columnIndex) const

Get the actual type of a column.

Parameters
columnIndexindex 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

◆ GetDatabaseName()

wxString wxSQLite3ResultSet::GetDatabaseName ( int columnIndex) const

Get the database name of a column.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
database name the column belongs to or empty string

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

◆ GetDate() [1/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnNamename of the column
Returns
value of the column

◆ GetDate() [2/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ GetDateTime() [1/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnNamename of the column
Returns
value of the column

◆ GetDateTime() [2/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ GetDeclaredColumnType()

wxString wxSQLite3ResultSet::GetDeclaredColumnType ( int columnIndex) const

Get the declared type of a column.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
type string as specified in the table definition

◆ GetDouble() [1/2]

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

Get a column as a double using the column name.

Parameters
columnNamename of the column
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetDouble() [2/2]

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

Get a column as a double using the column index.

Parameters
columnIndexindex of the column. Indices start with 0.
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetExpandedSQL()

wxString wxSQLite3ResultSet::GetExpandedSQL ( ) const

Get the original SQL string for preparing the query statement with expanded bound parameters.

Returns
the original SQL string used to prepare the statement with expanded bound parameters

◆ GetInt() [1/2]

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

Get a column as an integer using the column name.

Parameters
columnNamename of the column
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetInt() [2/2]

int wxSQLite3ResultSet::GetInt ( int columnIndex,
int nullValue = 0 ) const

Get a column as an integer using the column index.

Parameters
columnIndexindex of the column. Indices start with 0.
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetInt64() [1/2]

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

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

Parameters
columnNamename of the column
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetInt64() [2/2]

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

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

Parameters
columnIndexindex of the column. Indices start with 0.
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetJulianDayNumber() [1/2]

wxDateTime wxSQLite3ResultSet::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).

Parameters
columnNamename of the column
Returns
value of the column

◆ GetJulianDayNumber() [2/2]

wxDateTime wxSQLite3ResultSet::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).

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ GetNumericDateTime() [1/2]

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

Parameters
columnNamename of the column
Returns
value of the column

◆ GetNumericDateTime() [2/2]

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

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ GetOriginName()

wxString wxSQLite3ResultSet::GetOriginName ( int columnIndex) const

Get the origin name of a column.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
origin name the column belongs to or empty string

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

◆ GetSQL()

wxString wxSQLite3ResultSet::GetSQL ( ) const

Get the original SQL string for preparing the query statement.

Returns
the original SQL string used to prepare the query statement

◆ GetString() [1/2]

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

Get a column as a string using the column name.

Parameters
columnNamename of the column
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetString() [2/2]

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

Get a column as a string using the column index.

Parameters
columnIndexindex of the column. Indices start with 0.
nullValuevalue to be returned in case the column is NULL
Returns
value of the column

◆ GetTableName()

wxString wxSQLite3ResultSet::GetTableName ( int columnIndex) const

Get the table name of a column.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
table name the column belongs to or empty string

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

◆ GetTime() [1/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnNamename of the column
Returns
value of the column

◆ GetTime() [2/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ GetTimestamp() [1/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnNamename of the column
Returns
value of the column

◆ GetTimestamp() [2/2]

wxDateTime wxSQLite3ResultSet::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'.

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ GetUnixDateTime() [1/2]

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

Parameters
columnNamename of the column
Returns
value of the column

◆ GetUnixDateTime() [2/2]

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

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
value of the column

◆ IsNull() [1/2]

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

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

Parameters
columnNamename of the column
Returns
TRUE if the value is NULL, FALSE otherwise

◆ IsNull() [2/2]

bool wxSQLite3ResultSet::IsNull ( int columnIndex) const

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

Parameters
columnIndexindex of the column. Indices start with 0.
Returns
TRUE if the value is NULL, FALSE otherwise

◆ IsOk()

bool wxSQLite3ResultSet::IsOk ( ) const

Validate associated SQLite database and statement.

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

◆ NextRow()

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

◆ operator=()

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

Assignment constructor.


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