wxSQLite3 4.9.12
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
wxSQLite3FunctionContext Class Reference

Context for user defined scalar or aggregate functions. More...

#include <wxsqlite3.h>

Public Member Functions

virtual ~wxSQLite3FunctionContext ()
 Default destructor.
 
int GetArgCount () const
 Get the number of function arguments.
 
int GetArgType (int argIndex) const
 Get the type of a function argument.
 
bool IsNull (int argIndex) const
 Check whether a function argument is a NULL value.
 
int GetInt (int argIndex, int nullValue=0) const
 Get a function argument as an integer value.
 
wxLongLong GetInt64 (int argIndex, wxLongLong nullValue=0) const
 Get a function argument as an 64-bit integer value.
 
double GetDouble (int argIndex, double nullValue=0) const
 Get a function argument as a double value.
 
wxString GetString (int argIndex, const wxString &nullValue=wxEmptyString) const
 Get a function argument as a string value.
 
const unsigned char * GetBlob (int argIndex, int &len) const
 Get a function argument as a BLOB value.
 
wxMemoryBuffer & GetBlob (int argIndex, wxMemoryBuffer &buffer) const
 Get a function argument as a BLOB value.
 
void * GetPointer (int argIndex, const wxString &pointerType) const
 Get a function argument as a pointer value.
 
void SetResult (int value)
 Set the function result as an integer value.
 
void SetResult (wxLongLong value)
 Set the function result as an 64-bit integer value.
 
void SetResult (double value)
 Set the function result as a double value.
 
void SetResult (const wxString &value)
 Set the function result as a string value.
 
void SetResult (unsigned char *value, int len)
 Set the function result as a BLOB value.
 
void SetResult (const wxMemoryBuffer &buffer)
 Set the function result as a BLOB value.
 
void SetResult (void *pointer, const wxString &pointerType, void(*DeletePointer)(void *)=NULL)
 Set the function result as a pointer value.
 
void SetResultNull ()
 Set the function result as a NULL value.
 
void SetResultZeroBlob (int blobSize)
 Set the function result as a zero BLOB value.
 
void SetResultArg (int argIndex)
 Set the function result as a exact copy of a function argument.
 
void SetResultError (const wxString &errmsg)
 Set an error message as the function result.
 
int GetAggregateCount () const
 Get the number of aggregate steps.
 
void * GetAggregateStruct (int len) const
 Get a pointer to an aggregate structure of specified length.
 

Static Public Member Functions

static void ExecScalarFunction (void *ctx, int argc, void **argv)
 Execute a user defined scalar function (internal use only)
 
static void ExecAggregateStep (void *ctx, int argc, void **argv)
 Execute an aggregate step of a user defined aggregate function (internal use only)
 
static void ExecAggregateFinalize (void *ctx)
 Execute the final step of a user defined aggregate function (internal use only)
 
static void ExecWindowStep (void *ctx, int argc, void **argv)
 Execute an aggregate step of a user defined aggregate window function (internal use only)
 
static void ExecWindowFinalize (void *ctx)
 Execute the final step of a user defined aggregate window function (internal use only)
 
static void ExecWindowValue (void *ctx)
 Execute the current value step of a user defined aggregate window function (internal use only)
 
static void ExecWindowInverse (void *ctx, int argc, void **argv)
 Execute the inverse step of a user defined aggregate window function (internal use only)
 
static int ExecCommitHook (void *hook)
 Execute the user defined commit hook (internal use only)
 
static void ExecRollbackHook (void *hook)
 Execute the user defined rollback hook (internal use only)
 
static void ExecUpdateHook (void *hook, int type, const char *database, const char *table, wxsqlite_int64 rowid)
 Execute the user defined update hook (internal use only)
 
static int ExecWriteAheadLogHook (void *hook, void *dbHandle, const char *database, int numPages)
 Execute the user defined Write Ahead Log hook (internal use only)
 

Detailed Description

Context for user defined scalar or aggregate functions.

A function context gives user defined scalar or aggregate functions access to function arguments and function results. The "Execute" method resp. the "Aggregate" and "Finalize" methods receive the current function context as an argument.

Constructor & Destructor Documentation

◆ ~wxSQLite3FunctionContext()

wxSQLite3FunctionContext::~wxSQLite3FunctionContext ( )
virtual

Default destructor.

Member Function Documentation

◆ ExecAggregateFinalize()

void wxSQLite3FunctionContext::ExecAggregateFinalize ( void * ctx)
static

Execute the final step of a user defined aggregate function (internal use only)

◆ ExecAggregateStep()

void wxSQLite3FunctionContext::ExecAggregateStep ( void * ctx,
int argc,
void ** argv )
static

Execute an aggregate step of a user defined aggregate function (internal use only)

◆ ExecCommitHook()

int wxSQLite3FunctionContext::ExecCommitHook ( void * hook)
static

Execute the user defined commit hook (internal use only)

◆ ExecRollbackHook()

void wxSQLite3FunctionContext::ExecRollbackHook ( void * hook)
static

Execute the user defined rollback hook (internal use only)

◆ ExecScalarFunction()

void wxSQLite3FunctionContext::ExecScalarFunction ( void * ctx,
int argc,
void ** argv )
static

Execute a user defined scalar function (internal use only)

◆ ExecUpdateHook()

void wxSQLite3FunctionContext::ExecUpdateHook ( void * hook,
int type,
const char * database,
const char * table,
wxsqlite_int64 rowid )
static

Execute the user defined update hook (internal use only)

◆ ExecWindowFinalize()

void wxSQLite3FunctionContext::ExecWindowFinalize ( void * ctx)
static

Execute the final step of a user defined aggregate window function (internal use only)

◆ ExecWindowInverse()

void wxSQLite3FunctionContext::ExecWindowInverse ( void * ctx,
int argc,
void ** argv )
static

Execute the inverse step of a user defined aggregate window function (internal use only)

◆ ExecWindowStep()

void wxSQLite3FunctionContext::ExecWindowStep ( void * ctx,
int argc,
void ** argv )
static

Execute an aggregate step of a user defined aggregate window function (internal use only)

◆ ExecWindowValue()

void wxSQLite3FunctionContext::ExecWindowValue ( void * ctx)
static

Execute the current value step of a user defined aggregate window function (internal use only)

◆ ExecWriteAheadLogHook()

int wxSQLite3FunctionContext::ExecWriteAheadLogHook ( void * hook,
void * dbHandle,
const char * database,
int numPages )
static

Execute the user defined Write Ahead Log hook (internal use only)

◆ GetAggregateCount()

int wxSQLite3FunctionContext::GetAggregateCount ( ) const

Get the number of aggregate steps.

Returns
the number of aggregation steps. The current aggregation step counts so at least 1 is returned.

◆ GetAggregateStruct()

void * wxSQLite3FunctionContext::GetAggregateStruct ( int len) const

Get a pointer to an aggregate structure of specified length.

Usually an aggregation functions needs temporary memory to collect the information gathered from each invocation of the "Aggregate" method. On the first invocation of this method the returned memory contains binary zeros. If this memory is used to store pointers to allocated objects, it is important to free all allocated objects in the "Finalize" method.

Parameters
lenamount of memory needed in bytes
Returns
pointer to the allocated memory

◆ GetArgCount()

int wxSQLite3FunctionContext::GetArgCount ( ) const

Get the number of function arguments.

Returns
the number of arguments the function was called with

◆ GetArgType()

int wxSQLite3FunctionContext::GetArgType ( int argIndex) const

Get the type of a function argument.

Parameters
argIndexindex of the function argument. Indices start with 0.
Returns
argument type as one of the values WXSQLITE_INTEGER, WXSQLITE_FLOAT, WXSQLITE_TEXT, WXSQLITE_BLOB, or WXSQLITE_NULL

◆ GetBlob() [1/2]

const unsigned char * wxSQLite3FunctionContext::GetBlob ( int argIndex,
int & len ) const

Get a function argument as a BLOB value.

Parameters
argIndexindex of the function argument. Indices start with 0.
[out]lenlength of the blob argument in bytes
Returns
argument value

◆ GetBlob() [2/2]

wxMemoryBuffer & wxSQLite3FunctionContext::GetBlob ( int argIndex,
wxMemoryBuffer & buffer ) const

Get a function argument as a BLOB value.

Parameters
argIndexindex of the function argument. Indices start with 0.
[out]bufferto which the blob argument value is appended
Returns
reference to argument value

◆ GetDouble()

double wxSQLite3FunctionContext::GetDouble ( int argIndex,
double nullValue = 0 ) const

Get a function argument as a double value.

Parameters
argIndexindex of the function argument. Indices start with 0.
nullValuevalue to be returned in case the argument is NULL
Returns
argument value

◆ GetInt()

int wxSQLite3FunctionContext::GetInt ( int argIndex,
int nullValue = 0 ) const

Get a function argument as an integer value.

Parameters
argIndexindex of the function argument. Indices start with 0.
nullValuevalue to be returned in case the argument is NULL
Returns
argument value

◆ GetInt64()

wxLongLong wxSQLite3FunctionContext::GetInt64 ( int argIndex,
wxLongLong nullValue = 0 ) const

Get a function argument as an 64-bit integer value.

Parameters
argIndexindex of the function argument. Indices start with 0.
nullValuevalue to be returned in case the argument is NULL
Returns
argument value

◆ GetPointer()

void * wxSQLite3FunctionContext::GetPointer ( int argIndex,
const wxString & pointerType ) const

Get a function argument as a pointer value.

Parameters
argIndexindex of the function argument. Indices start with 0.
pointerTypea name identifying the pointer type.
Returns
argument value

◆ GetString()

wxString wxSQLite3FunctionContext::GetString ( int argIndex,
const wxString & nullValue = wxEmptyString ) const

Get a function argument as a string value.

Parameters
argIndexindex of the function argument. Indices start with 0.
nullValuevalue to be returned in case the argument is NULL
Returns
argument value

◆ IsNull()

bool wxSQLite3FunctionContext::IsNull ( int argIndex) const

Check whether a function argument is a NULL value.

Parameters
argIndexindex of the function argument. Indices start with 0.
Returns
TRUE if the argument is NULL or the argIndex is out of bounds, FALSE otherwise

◆ SetResult() [1/7]

void wxSQLite3FunctionContext::SetResult ( const wxMemoryBuffer & buffer)

Set the function result as a BLOB value.

Parameters
buffercontaining the function result value

◆ SetResult() [2/7]

void wxSQLite3FunctionContext::SetResult ( const wxString & value)

Set the function result as a string value.

Parameters
valuefunction result value

◆ SetResult() [3/7]

void wxSQLite3FunctionContext::SetResult ( double value)

Set the function result as a double value.

Parameters
valuefunction result value

◆ SetResult() [4/7]

void wxSQLite3FunctionContext::SetResult ( int value)

Set the function result as an integer value.

Parameters
valuefunction result value

◆ SetResult() [5/7]

void wxSQLite3FunctionContext::SetResult ( unsigned char * value,
int len )

Set the function result as a BLOB value.

Parameters
valuefunction result value
lenlength of the result blob in bytes

◆ SetResult() [6/7]

void wxSQLite3FunctionContext::SetResult ( void * pointer,
const wxString & pointerType,
void(*)(void *) DeletePointer = NULL )

Set the function result as a pointer value.

Parameters
pointerpointer value
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)

◆ SetResult() [7/7]

void wxSQLite3FunctionContext::SetResult ( wxLongLong value)

Set the function result as an 64-bit integer value.

Parameters
valuefunction result value

◆ SetResultArg()

void wxSQLite3FunctionContext::SetResultArg ( int argIndex)

Set the function result as a exact copy of a function argument.

Parameters
argIndexindex of the argument which should be copied as the result value

◆ SetResultError()

void wxSQLite3FunctionContext::SetResultError ( const wxString & errmsg)

Set an error message as the function result.

Parameters
errmsgstring containing an error message

◆ SetResultNull()

void wxSQLite3FunctionContext::SetResultNull ( )

Set the function result as a NULL value.

◆ SetResultZeroBlob()

void wxSQLite3FunctionContext::SetResultZeroBlob ( int blobSize)

Set the function result as a zero BLOB value.

Parameters
blobSizesize of the zero filled BLOB value

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