Berkeley DB Reference Guide: Simple Tutorial
Google

ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++">

Berkeley DB Reference Guide: Simple Tutorial

Removing elements from a database

The simplest way to remove elements from a database is the DB->del interface. This interface is accessed through a function pointer that is an element of the database handle returned by db_open.

The DB->del interface takes four of the same five arguments that the DB->get and DB->put interfaces take. The difference is that there is no need to specify a data item, as the delete operation is only interested in the key that you want to remove.

db
The database handle returned by db_open.

txnid
A transaction ID. In our simple case, we aren't expecting to recover the database after application or system crash, so we aren't using transactions, and will leave this argument unspecified.

key
The key item for the key/data pair that we want to retrieve from the database.

flags
Optional flags modifying the underlying behavior of the DB->del interface. There are currently no available flags for this interface, so the flags argument should always be set to 0.

Here's what the code to call DB->del looks like: