Berkeley DB Reference Guide:
Access Methods


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.

Databases and Related MethodsDescription
DB->associateAssociate a secondary index
DB->closeClose a database
DB->cursorCreate a cursor handle
DB->delDelete items from a database
DB->errError message with error string
DB->errxError message
DB->fdReturn a file descriptor from a database
DB->getGet items from a database
DB->get_byteswappedReturn if the underlying database is in host order
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->pgetGet items from a database
DB->putStore items into a database
DB->removeRemove a database
DB->renameRename a database
DB->set_allocSet local space allocation functions
DB->set_append_recnoSet record append callback
DB->set_bt_compareSet a Btree comparison function
DB->set_bt_minkeySet the minimum number of keys per Btree page
DB->set_bt_prefixSet a Btree prefix comparison function
DB->set_cache_prioritySet the database cache priority
DB->set_cachesizeSet the database cache size
DB->set_dup_compareSet a duplicate comparison function
DB->set_encryptSet the database cryptographic key
DB->set_errcallSet error message callback
DB->set_errfileSet error message FILE
Db::set_error_streamSet error message output stream
DB->set_errpfxSet error message prefix
DB->set_feedbackSet feedback callback
DB->set_flagsGeneral database configuration
DB->set_h_ffactorSet the Hash table density
DB->set_h_hashSet a hashing function
DB->set_h_nelemSet the Hash table size
DB->set_lorderSet the database byte order
DB->set_pagesizeSet the underlying database page size
DB->set_paniccallSet panic callback
DB->set_q_extentsizeSet Queue database extent size
DB->set_re_delimSet the variable-length record delimiter
DB->set_re_lenSet the fixed-length record length
DB->set_re_padSet the fixed-length record pad byte
DB->set_re_sourceSet the backing Recno text file
DB->statReturn database statistics
DB->syncFlush a database to stable storage
DB->truncateEmpty a database
DB->upgradeUpgrade a database
DB->verifyVerify/salvage a database


Copyright Sleepycat Software