Symisc Vedis

An Embeddable Datastore Engine



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

Syntax

int vedis_value_to_int(vedis_value *pValue);

int vedis_value_to_bool(vedis_value *pValue);

vedis_int64 vedis_value_to_int64(vedis_value *pValue);

double vedis_value_to_double(vedis_value *pValue);

const char * vedis_value_to_string(vedis_value *pValue,int *pLen);


Obtaining Vedis objects values.


Description


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


The vedis_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 vedis_value_to_string() can be invalidated by subsequent call to vedis_value_to_int(), vedis_value_to_bool(), vedis_value_to_int64() or vedis_value_to_double().


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


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

Parameters


pValue

A pointer to a vedis 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 Object Values, Setting the Result of a Foreign Command, Vedis Object Values Type.



Symisc Systems
Copyright © Symisc Systems