wxSQLite3 3.3.0

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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

## Static Public Member Functions
static void | ExecScalarFunction (void *ctx, int argc, void **argv)
| Execute a user defined scalar function (internal use only) More...
static void | ExecAggregateStep (void *ctx, int argc, void **argv)
| Execute an aggregate step of a user defined aggregate function (internal use only) More...
static void | ExecAggregateFinalize (void *ctx)
| Execute the final step of a user defined aggregate function (internal use only) More...
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) More...
static int | ExecCommitHook (void *hook)
| Execute the user defined commit hook (internal use only) More...
static void | ExecRollbackHook (void *hook)
| Execute the user defined rollback hook (internal use only) More...
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) More...
static int | ExecWriteAheadLogHook (void *hook, void *dbHandle, const char *database, int numPages)
| Execute the user defined Write Ahead Log hook (internal use only) More...

## 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

  len | amount 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

  argIndex | index 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

  | argIndex | index of the function argument. Indices start with 0.
  [out] | len | length 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

  | argIndex | index of the function argument. Indices start with 0.
  [out] | buffer | to 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

  argIndex | index of the function argument. Indices start with 0.
  nullValue | value 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

  argIndex | index of the function argument. Indices start with 0.
  nullValue | value 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

  argIndex | index of the function argument. Indices start with 0.
  nullValue | value 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

  argIndex | index of the function argument. Indices start with 0.
  nullValue | value 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

  argIndex | index 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 | ( | int | value | ) |

Set the function result as an integer value.

Parameters

  value | function result value

void wxSQLite3FunctionContext::SetResult | ( | wxLongLong | value | ) |

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

Parameters

  value | function result value

void wxSQLite3FunctionContext::SetResult | ( | double | value | ) |

Set the function result as a double value.

Parameters

  value | function result value

void wxSQLite3FunctionContext::SetResult | ( | const wxString & | value | ) |

Set the function result as a string value.

Parameters

  value | function result value

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

Set the function result as a BLOB value.

Parameters

  value | function result value
  len | length of the result blob in bytes

void wxSQLite3FunctionContext::SetResult | ( | const wxMemoryBuffer & | buffer | ) |

Set the function result as a BLOB value.

Parameters

  buffer | containing the function result value

void wxSQLite3FunctionContext::SetResultArg | ( | int | argIndex | ) |

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

Parameters

  argIndex | index 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

  errmsg | string 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

  blobSize | size of the zero filled BLOB value

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

- wxsqlite3.h
- wxsqlite3.cpp