Symisc UnQLite

An Embeddable NoSQL Database Engine



UnQLite C/C++ API Reference - Foreign function auxiliary private data.

Syntax

int unqlite_context_push_aux_data(unqlite_context *pCtx,void *pUserData);

void * unqlite_context_peek_aux_data(unqlite_context *pCtx);

void * unqlite_context_pop_aux_data(unqlite_context *pCtx);


Push, Peek and Pop auxiliary private data of a foreign function.


Description


These interfaces are available to foreign functions in the case they need a stack for an arbitrary number of auxiliary private data perhaps to keep some state information (i.e. The built-in strtok() function rely on these routines heavily).


The unqlite_context_push_aux_data() routine pushes an arbitrary pointer in the auxiliary data stack.

The unqlite_context_peek_aux_data() routine return the last pushed user pointer in the auxiliary data stack.

The unqlite_context_pop_aux_data() pops and returns the last pushed user pointer in the auxiliary data stack.


These interfaces accepts as their first argument a pointer to a unqlite_context which mean that they are designed to be invoked only from a foreign function. Also note that each registered foreign function have its own auxiliary data stack.


These routines must be called from the same thread in which the application-defined function is running.


Parameters


pCtx

Foreign function Call Context.


Return value


unqlite_context_push_aux_data() return UNQLITE_OK if the pointer was successfully pushed on the stack. Any other return value indicates failure (Out of memory).


unqlite_context_peek_aux_data() and unqlite_context_pop_aux_data() return the last pushed user pointer in the auxiliary data stack or NULL if the stack is empty.


See also


Installing Foreign Functions.



Symisc Systems
Copyright © Symisc Systems