Updating the value of a key
#include "btree.h"
int bupdky(BTA* btact, char* key, BTint value);
The bupdky function updates the value of
an existing key in the current root of the file associated
with the btact context pointer. The
key, a character string, is passed via the pointer in
key. The new value is passed via
value. value is
declared as a BTint, which is normally a typedef for
int, but with Large File Support will be
a typedef for long long.
If the key does not exist, bupdky returns
the error code QNOKEY.
If bupdky is called with a
key value of NULL, the update operation
will act against the current key, as selected by
bfndky, bnxtky or
bprvky operations. This capability is
designed to allow update of a duplicate key, presumably based
on other, application managed, attributes. Note that this
capability is prohibited when duplicate keys exist and the
index has been opened shared. Exclusive access must be gained
via the btlock function
in this case.
bupdky returns zero to indicate a
successful update, error code otherwise.