wxSQLite3 3.0.0
Public Member Functions | Static Public Member Functions
wxSQLite3FunctionContext Class Reference

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

#include <wxsqlite3.h>

List of all members.

Public Member Functions

int GetArgCount ()
 Get the number of function arguments.
int GetArgType (int argIndex)
 Get the type of a function argument.
bool IsNull (int argIndex)
 Check whether a function argument is a NULL value.
int GetInt (int argIndex, int nullValue=0)
 Get a function argument as an integer value.
wxLongLong GetInt64 (int argIndex, wxLongLong nullValue=0)
 Get a function argument as an 64-bit integer value.
double GetDouble (int argIndex, double nullValue=0)
 Get a function argument as a double value.
wxString GetString (int argIndex, const wxString &nullValue=wxEmptyString)
 Get a function argument as a string value.
const unsigned char * GetBlob (int argIndex, int &len)
 Get a function argument as a BLOB value.
wxMemoryBuffer & GetBlob (int argIndex, wxMemoryBuffer &buffer)
 Get a function argument as a BLOB 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 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 ()
 Get the number of aggregate steps.
void * GetAggregateStruct (int len)
 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 int ExecAuthorizer (void *, int type, const char *arg1, const char *arg2, const char *arg3, const char *arg4)
 Execute the user defined authorizer 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.


Member Function Documentation

void wxSQLite3FunctionContext::ExecAggregateFinalize ( void *  ctx) [static]

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

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

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

int wxSQLite3FunctionContext::ExecAuthorizer ( void *  func,
int  type,
const char *  arg1,
const char *  arg2,
const char *  arg3,
const char *  arg4 
) [static]

Execute the user defined authorizer function (internal use only)

int wxSQLite3FunctionContext::ExecCommitHook ( void *  hook) [static]

Execute the user defined commit hook (internal use only)

void wxSQLite3FunctionContext::ExecRollbackHook ( void *  hook) [static]

Execute the user defined rollback hook (internal use only)

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

Execute a user defined scalar function (internal use only)

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)

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

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

int wxSQLite3FunctionContext::GetAggregateCount ( )

Get the number of aggregate steps.

Returns:
the number of aggregation steps. The current aggregation step counts so at least 1 is returned.
void * wxSQLite3FunctionContext::GetAggregateStruct ( int  len)

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
int wxSQLite3FunctionContext::GetArgCount ( )

Get the number of function arguments.

Returns:
the number of arguments the function was called with
int wxSQLite3FunctionContext::GetArgType ( int  argIndex)

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
const unsigned char* wxSQLite3FunctionContext::GetBlob ( int  argIndex,
int &  len 
)

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
wxMemoryBuffer & wxSQLite3FunctionContext::GetBlob ( int  argIndex,
wxMemoryBuffer &  buffer 
)

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
double wxSQLite3FunctionContext::GetDouble ( int  argIndex,
double  nullValue = 0 
)

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
int wxSQLite3FunctionContext::GetInt ( int  argIndex,
int  nullValue = 0 
)

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
wxLongLong wxSQLite3FunctionContext::GetInt64 ( int  argIndex,
wxLongLong  nullValue = 0 
)

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
wxString wxSQLite3FunctionContext::GetString ( int  argIndex,
const wxString &  nullValue = wxEmptyString 
)

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
bool wxSQLite3FunctionContext::IsNull ( int  argIndex)

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
void wxSQLite3FunctionContext::SetResult ( wxLongLong  value)

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

Parameters:
valuefunction result value
void wxSQLite3FunctionContext::SetResult ( int  value)

Set the function result as an integer value.

Parameters:
valuefunction result value
void wxSQLite3FunctionContext::SetResult ( const wxString &  value)

Set the function result as a string value.

Parameters:
valuefunction result value
void wxSQLite3FunctionContext::SetResult ( const wxMemoryBuffer &  buffer)

Set the function result as a BLOB value.

Parameters:
buffercontaining the function result value
void wxSQLite3FunctionContext::SetResult ( double  value)

Set the function result as a double value.

Parameters:
valuefunction result value
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
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
void wxSQLite3FunctionContext::SetResultError ( const wxString &  errmsg)

Set an error message as the function result.

Parameters:
errmsgstring containing an error message
void wxSQLite3FunctionContext::SetResultNull ( )

Set the function result as a NULL value.

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: