NAME

sp_delete - delete operation

SYNOPSIS

#include <sophia.h>

int sp_delete(void *object, void *document);

DESCRIPTION

sp_delete(database, document): do a single-statement transaction.

sp_delete(transaction, document): do a key deletion as a part of multi-statement transaction.

As a part of a transactional statement a key-value document must be prepared using sp_document() method. First argument of sp_document() method must be an database object.

Object must be prepared by setting key fields. Value is not used for delete operation. It is important that while setting key fields, only pointers are copied. Real data copies only during first operation.

For additional information take a look at sp_document(), sp_begin() and Transactions.

EXAMPLE

char key[] = "key";
void *o = sp_document(db);
sp_setstring(o, "key", key, sizeof(key));
sp_delete(db, o);

RETURN VALUE

On success, sp_delete() returns 0. On error, it returns -1.

Database object commit: (1) rollback or (2) lock.

SEE ALSO

Sophia API