Berkeley DB: Db::del
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btr ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++

# Db::del

`

###

    #include <db_cxx.h>

    int
    Db::del(DbTxn *txnid, Dbt *key, u_int32_t flags);

# Description

The Db::del method removes key/data pairs from the database. The key/data pair associated with the specified key is discarded from the database. In the presence of duplicate key values, all records associated with the designated key will be discarded.

If the file is being accessed under transaction protection, the txnid parameter is a transaction ID returned from DbTxnMgr::begin, otherwise, NULL.

The flags parameter is currently unused, and must be set to 0.

The Db::del method either returns errno or throws an exception that encapsulates an errno on failure, and 0 on success, and DB_NOTFOUND if the specified key did not exist in the file.

# Errors

If a fatal error occurs in Berkeley DB, the Db::del method may fail and either return DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY, at which point all subsequent database calls will also fail in the same way. Methods marked as returning errno will, by default, throw an exception that encapsulates the error information. The default error behavior can be changed, see DbException.

The Db::del method may fail and throw an exception for any of the errors specified for the following Berkeley DB and C library functions: Db::cursor, DBcursor->c_close(3), DBcursor->c_del(3), Dbc::get, __account_page(3), dbenv->db_paniccall(3), fflush(3), fprintf(3), free(3), func(3), hcp->dbc->dbp->h_hash(3), DbLockTab::get, DbLock::put, DbLockTab::vec, DbLog::put, malloc(3), memcmp(3), memcpy(3), memmove(3), DbMpoolFile::get, DbMpoolFile::put, DbMpoolFile::set, memset(3), realloc(3), strerror(3), vfprintf(3), and vsnprintf(3).

In addition, the Db::del method may fail and throw an exception or return errno for the following conditions:

EACCES
  An attempt was made to modify a read-only database.

EINVAL
  An invalid flag value or parameter was specified.

# Class

Db

# See Also

Db::close, Db::cursor, Db::del, Db::fd, Db::get, Db::get_byteswapped, Db::get_type, Db::join, Db::open, Db::put, Db::stat and Db::sync.`