wxSQLite3 4.9.10
Loading...
Searching...
No Matches
Public Member Functions | List of all members
wxSQLite3Statement Class Reference

Represents a prepared SQL statement. More...

#include <wxsqlite3.h>

Public Member Functions

 wxSQLite3Statement ()
 Constructor.
 
 wxSQLite3Statement (const wxSQLite3Statement &statement)
 Copy constructor.
 
wxSQLite3Statementoperator= (const wxSQLite3Statement &statement)
 Assignment constructor.
 
 wxSQLite3Statement (wxSQLite3DatabaseReference *db, wxSQLite3StatementReference *stmt)
 Constructor (internal use only)
 
virtual ~wxSQLite3Statement ()
 Destructor.
 
int ExecuteUpdate ()
 Execute the database update represented by this statement.
 
wxSQLite3ResultSet 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 &paramName) 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 *)=NULL)
 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 &timestamp)
 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 (wxSQLite3StatementStatus opCode, bool resetFlag=false) const
 Determine internal operation counters of the underlying prepared statement.
 

Detailed Description

Represents a prepared SQL statement.

Constructor & Destructor Documentation

◆ wxSQLite3Statement() [1/3]

wxSQLite3Statement::wxSQLite3Statement ( )

Constructor.

◆ wxSQLite3Statement() [2/3]

wxSQLite3Statement::wxSQLite3Statement ( const wxSQLite3Statement & statement)

Copy constructor.

◆ wxSQLite3Statement() [3/3]

wxSQLite3Statement::wxSQLite3Statement ( wxSQLite3DatabaseReference * db,
wxSQLite3StatementReference * stmt )

Constructor (internal use only)

◆ ~wxSQLite3Statement()

wxSQLite3Statement::~wxSQLite3Statement ( )
virtual

Destructor.

Member Function Documentation

◆ Bind() [1/8]

void wxSQLite3Statement::Bind ( int paramIndex,
const char * charValue )

Bind parameter to a utf-8 character string value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
charValuevalue of the parameter

◆ Bind() [2/8]

void wxSQLite3Statement::Bind ( int paramIndex,
const unsigned char * blobValue,
int blobLen )

Bind parameter to a BLOB value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
blobValuevalue of the parameter
blobLenlength of the blob in bytes

◆ Bind() [3/8]

void wxSQLite3Statement::Bind ( int paramIndex,
const wxMemoryBuffer & blobValue )

Bind parameter to a BLOB value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
blobValuevalue of the parameter

◆ Bind() [4/8]

void wxSQLite3Statement::Bind ( int paramIndex,
const wxString & stringValue )

Bind parameter to a string value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
stringValuevalue of the parameter

◆ Bind() [5/8]

void wxSQLite3Statement::Bind ( int paramIndex,
double doubleValue )

Bind parameter to a double value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
doubleValuevalue of the parameter

◆ Bind() [6/8]

void wxSQLite3Statement::Bind ( int paramIndex,
int intValue )

Bind parameter to a integer value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
intValuevalue of the parameter

◆ Bind() [7/8]

void wxSQLite3Statement::Bind ( int paramIndex,
void * pointer,
const wxString & pointerType,
void(*)(void *) DeletePointer = NULL )

Bind parameter to a pointer value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
pointerpointer value of the parameter
pointerTypedescriptive name of the pointer type as expected by the extension module
DeletePointerpointer to a function for deleting the object pointed to by the pointer after use in SQLite (default: NULL)

◆ Bind() [8/8]

void wxSQLite3Statement::Bind ( int paramIndex,
wxLongLong int64Value )

Bind parameter to a 64-bit integer value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
int64Valuevalue of the parameter

◆ BindBool()

void wxSQLite3Statement::BindBool ( int paramIndex,
bool value )

Bind parameter to a boolean value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
valuevalue of the parameter

◆ BindDate()

void wxSQLite3Statement::BindDate ( int paramIndex,
const wxDateTime & date )

Bind parameter to a date value.

Only the date part is stored in format 'YYYY-MM-DD'.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
datevalue of the parameter

◆ BindDateTime()

void wxSQLite3Statement::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'.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
datetimevalue of the parameter

◆ BindJulianDayNumber()

void wxSQLite3Statement::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).

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
datetimevalue of the parameter

◆ BindNull()

void wxSQLite3Statement::BindNull ( int paramIndex)

Bind parameter to a NULL value.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.

◆ BindNumericDateTime()

void wxSQLite3Statement::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.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
datetimevalue of the parameter

◆ BindTime()

void wxSQLite3Statement::BindTime ( int paramIndex,
const wxDateTime & time )

Bind parameter to a time value.

Only the time part is stored in format 'HH:MM:SS'.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
timevalue of the parameter

◆ BindTimestamp()

void wxSQLite3Statement::BindTimestamp ( int paramIndex,
const wxDateTime & timestamp )

Bind parameter to a timestamp value.

Timestamp is stored in format 'YYYY-MM-DD HH:MM:SS.mmm'.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
timestampvalue of the parameter

◆ BindUnixDateTime()

void wxSQLite3Statement::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.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
datetimevalue of the parameter

◆ BindZeroBlob()

void wxSQLite3Statement::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.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
blobSizesize of the BLOB

◆ ClearBindings()

void wxSQLite3Statement::ClearBindings ( )

Clear all parameter bindings.

Sets all the parameters in the prepared SQL statement back to NULL.

◆ ExecuteQuery()

wxSQLite3ResultSet wxSQLite3Statement::ExecuteQuery ( )

Execute the query represented by this statement.

Returns
result set instance

◆ ExecuteScalar()

int wxSQLite3Statement::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.

Returns
first column of first row as an int

◆ ExecuteUpdate()

int wxSQLite3Statement::ExecuteUpdate ( )

Execute the database update represented by this statement.

Returns
the number of database rows that were changed (or inserted or deleted)

◆ Finalize()

void wxSQLite3Statement::Finalize ( )

Finalize the prepared statement.

◆ GetExpandedSQL()

wxString wxSQLite3Statement::GetExpandedSQL ( ) const

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

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

◆ GetParamCount()

int wxSQLite3Statement::GetParamCount ( ) const

Get the number of statement parameters.

Returns
the number of parameters in the prepared statement

◆ GetParamIndex()

int wxSQLite3Statement::GetParamIndex ( const wxString & paramName) const

Get the index of a parameter with a given name.

Parameters
paramName
Returns
the index of the parameter with the given name. The name must match exactly. If there is no parameter with the given name, return 0.

◆ GetParamName()

wxString wxSQLite3Statement::GetParamName ( int paramIndex) const

Get the name of a paramater at the given position.

Parameters
paramIndexindex of the parameter. The first parameter has an index of 1.
Returns
the name of the paramIndex-th parameter in the precompiled statement. Parameters of the form ":AAA" or "$VVV" have a name which is the string ":AAA" or "$VVV". Parameters of the form "?" have no name.

◆ GetSQL()

wxString wxSQLite3Statement::GetSQL ( ) const

Get the original SQL string for the prepared statement.

Returns
the original SQL string used to prepare the statement

◆ IsBusy()

bool wxSQLite3Statement::IsBusy ( ) const

Determine if a prepared statement has been reset.

Returns
TRUE if the prepared statement has been stepped at least once but has not run to completion and/or has not been reset, FALSE otherwise

◆ IsOk()

bool wxSQLite3Statement::IsOk ( ) const

Validate associated SQLite database and statement.

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

◆ IsReadOnly()

bool wxSQLite3Statement::IsReadOnly ( ) const

Determine whether the statement is read-only.

Returns
TRUE if the statement is read-only, FALSE otherwise
Since
SQLite3 version 3.7.4
Note
For SQLite3 version before version 3.7.4 this method returns always FALSE.

◆ operator=()

wxSQLite3Statement & wxSQLite3Statement::operator= ( const wxSQLite3Statement & statement)

Assignment constructor.

◆ Reset()

void wxSQLite3Statement::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.

◆ Status()

int wxSQLite3Statement::Status ( wxSQLite3StatementStatus 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.

Parameters
opCodeoperation code of the operation to be queried
resetFlagflag whether the associated counter should be reset to zero (default: false)
Returns
the counter value for the requested counter

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