NAME

sp_cursor - common cursor operation

SYNOPSIS

#include <sophia.h>

void *sp_cursor(void *env);

DESCRIPTION

sp_cursor(env): create a cursor ready to be used with any database.

For additional information take a look at Cursor section.

EXAMPLE

void *cursor = sp_cursor(env);
void *o = sp_document(db);
sp_setstring(o, "order", ">=", 0);
while ((o = sp_get(c, o))) {
    char *key = sp_getstring(o, "key", NULL);
    char *value = sp_getstring(o, "value", NULL);
    printf("%s = %s\n", key, value);
}
sp_destroy(cursor);

RETURN VALUE

On success, sp_cursor() returns cursor object handle. On error, it returns NULL.

SEE ALSO

Sophia API