gdbm_store inserts or replaces records in the database.
The parameters are:
The pointer returned by
The search key.
The data to be associated with the key.
Defines the action to take when the key is already in the database. The value
GDBM_REPLACE (defined in gdbm.h) asks that the old data
be replaced by the new content. The value
asks that an error be returned and no action taken if the key
This function can return the following values:
Success. The value of content is keyed by key in the database.
An error occurred which prevented the item from being stored in the
database. Examine the
gdbm_errno variable to determine the
actual cause of the error.
The item was not stored because the argument flag was
GDBM_INSERT and the key was already in the database.
gdbm_errno variable is set to
If the function returns -1,
gdbm_errno can have the following
Database was open in read-only mode, i.e. with the
flag. See Open.
Either key or content had their
dptr field set to
It is OK to have a zero-length key or content, i.e. a datum with
dsize set to 0, but the
dptr field must always be a
Database hash table is malformed. This usually means that some error
in the application or the library caused memory overrun. The database
is marked as needing recovery. All further calls on this database
will return with
gdbm_error set to
See Recovery, for a discussion of database recovery process.
Database directory entry is corrupted. The database is marked as needing recovery. See Recovery.
Database bucket is corrupted. The database is marked as needing recovery. See Recovery.
Database available storage index is corrupted. The database is marked as needing recovery. See Recovery.
A seek error occurred on the underlying disk file. Examine the system
errno variable for more detail.
If you store data for a key that is already in the data base,
gdbm replaces the old data with the new data if called with
GDBM_REPLACE. You do not get two data items for the same
key and you do not get an error from
The size of datum in
gdbm is restricted only by the maximum
value for an object of type
int (type of the
dsize member of