Berkeley DB Reference Guide:
Access Methods

PrevRefNext

Access method operations

Once a database handle has been created using db_create, there are several standard access method operations. Each of these operations is performed using a method referred to by the returned handle. Generally, the database will be opened using DB->open. If the database is from an old release of Berkeley DB, it may need to be upgraded to the current release before it is opened using DB->upgrade.

Once a database has been opened, records may be retrieved (DB->get), stored (DB->put), and deleted (DB->del).

Additional operations supported by the database handle include statistics (DB->stat), truncation (DB->truncate), version upgrade (DB->upgrade), verification and salvage (DB->verify), flushing to a backing file (DB->sync), and association of secondary indices (DB->associate). Database handles are eventually closed using DB->close.

Database OperationsDescription
db_createCreate a database handle
DB->associateAssociate a secondary index
DB->closeClose a database
DB->closeCreate a cursor
DB->delDelete items from a database
DB->err, DB->errxError message
DB->fdReturn a file descriptor from a database
DB->get, DB->pgetGet items from a database
DB->get_byteswappedReturn if the underlying database is in host order
DB->get_envReturn database environment handle
DB->mpfReturn underlying DB_MPOOLFILE handle
DB->get_typeReturn the database type
DB->joinPerform a database join on cursors
DB->key_rangeReturn estimate of key location
DB->openOpen a database
DB->putStore items into a database
DB->removeRemove a database
DB->renameRename a database
DB->stat,