Symisc UnQLite

An Embeddable NoSQL Database Engine



UnQLite C/C++ API Reference - Obtaining UnQLite Object Values.

Syntax

int unqlite_value_to_int(unqlite_value *pValue);

int unqlite_value_to_bool(unqlite_value *pValue);

unqlite_int64 unqlite_value_to_int64(unqlite_value *pValue);

double unqlite_value_to_double(unqlite_value *pValue);

const char * unqlite_value_to_string(unqlite_value *pValue,int *pLen);

void * unqlite_value_to_resource(unqlite_value *pValue);

int unqlite_value_compare(unqlite_value *pLeft,unqlite_value *pRight,int bStrict);


Obtaining UnQLite objects values.


Description


The C-language implementation of unQLite functions uses this set of interface routines to access the parameter values on the function. The xFunc parameter to unqlite_create_function() define callbacks that implement the UnQLite functions. The 3rd parameter to these callbacks is an array of pointers to unqlite_value objects. There is one unqlite_value object for each parameter to the foreign unqlite function. These routines are used to extract values from the unqlite_value objects. Please note that if the unqlite_value is not of the expected type, an automatic cast will be performed.


The unqlite_value_to_string() interface takes an optional parameter (int *pLen) which is set (if not NULL) to the string length. Also note, this function return a null terminated string and does never return the NULL pointer.


Please pay particular attention to the fact that the pointer returned from unqlite_value_to_string() can be invalidated by subsequent call to unqlite_value_to_int(), unqlite_value_to_bool(), unqlite_value_to_int64() or unqlite_value_to_double().


The unqlite_value_to_resource() interface will return NULL if the given unqlite_value is not of type resource.


The unqlite_value_compare() interface is used to compare two unqlite_value's. The return value will be 0 (zero) if the values are equals, >0 if the left (first argument) value is greater than the right (second argument) and <0 if the left (first argument) value is less than the right (second argument).


These routines must be called from the same thread as the foreign function that supplied the unqlite_value parameters.


Parameters


pValue

A pointer to a unqlite_value.


Return value


Value of the given parameter.


Example


Compile this C file for a smart introduction to these interfaces.


See also


On Demand Object Allocation, Populating UnQLite Object Values, Setting the Result of a Foreign Function, UnQLite Object Values Type.



Symisc Systems
Copyright © Symisc Systems