NAME
sp_get - common get operation
SYNOPSIS
#include <sophia.h>
void *sp_get(void *object, void *document);
DESCRIPTION
sp_get(database, document): do a single-statement transaction read.
sp_get(transaction, document): do a key search as a part of multi-statement transaction visibility.
sp_get() method returns an document that is semantically equal to sp_document(), but is read-only.
For additional information take a look at sp_begin() and Transactions.
EXAMPLE
void *o = sp_document(db);
sp_set(o, "key", "hello", 0);
void *result = sp_get(db, o);
if (result) {
int valuesize;
char *value = sp_getstring(result, "value", &valuesize);
printf("%s\n", value);
sp_destroy(result);
}
RETURN VALUE
On success, sp_get() returns a document handle. If an object is not found, returns NULL. On error, it returns NULL.
SEE ALSO