*I;Berkeley DB Reference Guide: Simple Tutorial[P5

Berkeley DB Reference Guide: Simple Tutorial



7

Removing elements from a database



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

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

\

db
The database handle returned by db_open.!

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

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

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


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



MAOÿÿ