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, DB->stat_printDatabase statistics
DB->syncFlush a database to stable storage
DB->truncateEmpty a database
DB->upgradeUpgrade a database
DB->verifyVerify/salvage a database
Database Configuration
DB->set_allocSet local space allocation functions
DB->set_cachesizeSet the database cache size
DB->set_dup_compareSet a duplicate comparison function
DB->set_encryptSet the database cryptographic key
DB->set_errcall, DB->set_msgcallSet error and informational message callback
DB->set_errfile, DB->set_msgfileSet error and informational message FILE
DB->set_errpfxSet error message prefix
DB->set_feedbackSet feedback callback
DB->set_flagsGeneral database configuration
DB->set_lorderSet the database byte order
DB->set_pagesizeSet the underlying database page size
DB->set_paniccallSet panic callback
Btree/Recno Configuration
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_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
Hash Configuration
DB->set_h_ffactorSet the Hash table density
DB->set_h_hashSet a hashing function
DB->set_h_nelemSet the Hash table size
Queue Configuration
DB->set_q_extentsizeSet Queue database extent size

PrevRefNext

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.