Berkeley DB: DbTxn::abort
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# DbTxn::abort |

`

###

    #include <db_cxx.h>

    int
    DbTxn::abort();

# Description

The DbTxn::abort method causes an abnormal termination of the transaction.

The log is played backwards and any necessary recovery operations are initiated through the recover function specified to DbEnv::open. After the log processing is completed, all locks held by the transaction are released. As is the case for DbTxn::commit, applications that require strict two-phase locking should not explicitly release any locks.

In the case of nested transactions, aborting the parent transaction causes all children of that transaction to be aborted.

The DbTxn::abort method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

# Errors

If a fatal error occurs in Berkeley DB, the DbTxn::abort method will fail and either return DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY, at which point all subsequent database calls will fail in the same way.

In addition, the DbTxn::abort method may fail and throw an exception or return a non-zero error for the following conditions:

EINVAL
  The transaction was already aborted.

In addition, the DbTxn::abort method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods.

### Classes

DbEnv, DbTxn

# See Also

DbEnv::set_tx_max, DbEnv::set_tx_recover, DbTxn::abort, DbEnv::txn_begin, DbEnv::txn_checkpoint, DbTxn::commit, DbTxn::id, DbTxn::prepare and DbEnv::txn_stat.`

Copyright Sleepycat Software