Berkeley DB Reference Version 5.3.33

DB->exists()

#include <db.h>

int
DB->exists(DB *db, DB_TXN *txnid, DBT *key, u_int32_t flags);  

The DB->exists() method returns whether the specified key appears in the database.

The DB->exists() method will return DB_NOTFOUND if the specified key is not in the database. The DB->exists() method will return DB_KEYEMPTY if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted.

Parameters

txnid

If the operation is part of an application-specified transaction, the txnid parameter is a transaction handle returned from DB_ENV->txn_begin(); if the operation is part of a Berkeley DB Concurrent Data Store group, the txnid parameter is a handle returned from DB_ENV->cdsgroup_begin(); otherwise NULL. If no transaction handle is specified, but the operation occurs in a transactional database, the operation will be implicitly transaction protected.

key

The key DBT operated on.

flags

The flags parameter must be set to zero or by bitwise inclusively OR'ing together one or more of the following values:

Class

DB

See Also

Database and Related Methods