Go to the first, previous, next, last section, table of contents.


Seting options.

Gdbm now supports the ability to set certain options on an already open database.

ret = gdbm_setopt(dbf, option, value, size)

The parameters are:

GDBM_FILE dbf
The pointer returned by gdbm_open.
int option
The option to be set.
int *value
A pointer to the value to which option will be set.
int size
The length of the data pointed to by value.

The only legal option currently is GDBM_CACHESIZE, which sets the size of the internal bucket cache. This option may only be set once on each GDBM_FILE descriptor, and is set automatically to 100 upon the first access to the database.

The return value will be -1 upon failure, or 0 upon success. The global variable gdbm_errno will be set upon failure.

For instance, to set a database to use a cache of 10, after opening it with gdbm_open, but prior to accessing it in any way, the following code could be used:

int value = 10;
ret = gdbm_setopt(dbf, GDBM_CACHESIZE, &value, sizeof(int));


Go to the first, previous, next, last section, table of contents.