Logo Search packages:      
Sourcecode: db4.2 version File versions  Download package

int com::sleepycat::db::Db::delete ( DbTxn  txnid,
Dbt  key,
int  flags 
) throws DbException [inline]

The Db.delete 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.

When called on a database that has been made into a secondary index using the Db.associate method, the Db.delete method deletes the key/data pair from the primary database and all secondary indices.

Parameters:
key The key Dbt operated on.
flags must be set to 0 or the following value:
  • Db.DB_AUTO_COMMIT

    Enclose the Db.delete call within a transaction. If the call succeeds, changes made by the operation will be recoverable. If the call fails, the operation will have made no changes.

txnid If the operation is to be transaction-protected, (other than by specifying the Db.DB_AUTO_COMMIT flag), the txnid parameter is a transaction handle returned from DbEnv.txnBegin; otherwise, null.
Exceptions:
DbException The Db.delete method may fail and throw DbException, encapsulating one of the following non-zero errors: An attempt was made to modify a read-only database.
DbDeadlockException If a transactional database environment operation was selected to resolve a deadlock, the Db.delete method will fail and throw a DbDeadlockException exception.
DbLockNotGrantedException If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the Db.delete method will fail and throw a DbLockNotGrantedException exception.
IllegalArgumentException The Db.delete method will fail and throw a IllegalArgumentException exception if an invalid flag value or parameter was specified.
Returns:
  • DB_KEYEMPTY

    The Db.delete method will return Db.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.

Unless otherwise specified, the Db.delete method throws an exception that encapsulates a non-zero error value on failure.

Definition at line 3431 of file Db.java.

                                                                          {
        return db_javaJNI.Db_del(swigCPtr, DbTxn.getCPtr(txnid), key, flags);
    }


Generated by  Doxygen 1.6.0   Back to index