Symisc Vedis

An Embeddable Datastore Engine



Vedis C/C++ API Reference - Array Type Processing.

Syntax

int vedis_array_reset(vedis_value *pArray);

vedis_value * vedis_array_next_elem(vedis_value *pArray);


Iterate over the elements of a given array.


Description


vedis_array_next_elem() return the current array entry pointed by the internal cursor and automatically advance it (i.e. the cursor) to the next element. Use the following interfaces to cast the object value returned by this interface to the desired type:


vedis_value_to_int()

vedis_value_to_bool()

vedis_value_to_int64()

vedis_value_to_double()

vedis_value_to_string()

If the array is empty or the end of the list is reached (i.e. No more entries to return) then this interfaces return NULL instead. vedis_array_reset() reset the internal cursor to point to the first array entry.

The vedis_value must be of type array obtained by a prior successful call to vedis_context_new_array() or passed as parameter to the foreign command.


Call vedis_value_is_array() to check if the given vedis_value is of the expected type. 


Note: This routine is not thread-safe.


Parameters


pArray

vedis_value to iterate over which must be of type array.


Return value


 Current array entry (vedis_value pointer) on success or NULL when no more entries.


Example


Compile this C file for a smart introduction to the array handling interfaces.


See also


vedis_array_walk, vedis_array_insert, vedis_array_fetch.



Symisc Systems
Copyright © Symisc Systems