Berkeley DB: DbTxnMgr::begin
Google

ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++">

DbTxnMgr::begin


#include <db_cxx.h>

int DbTxnMgr::begin(DbTxn *parent, DbTxn **tid);

Description

The DbTxnMgr::begin method creates a new transaction in the transaction manager, copying a pointer to a DbTxn that uniquely identifies it into the memory referenced by tid.

If the parent argument is non-NULL, the new transaction will be a nested transaction, with the transaction indicated by parent as its parent. Transactions may be nested to any level.

Note: transactions may not span threads, i.e., each transaction must begin and end in the same thread, and each transaction may only be used by a single thread.

Note: transactions may not span cursors, i.e., each transaction may only be used by a single cursor.

The DbTxnMgr::begin method either returns errno or throws an exception that encapsulates an errno on failure, and 0 on success.

Errors

If a fatal error occurs in Berkeley DB, the DbTxnMgr::begin 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 DbTxnMgr::begin method may fail and throw an exception for any of the errors specified for the following Berkeley DB and C library functions: abort(3), fcntl(3), fflush(3), fprintf(3), free(3), fsync(3), getpid(3), DbLog::put, lseek(3), memset(3), mmap(3), munmap(3), shmat(3), shmdt(3), strerror(3), vfprintf(3), vsnprintf(3), and write(3).

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

ENOSPC
The maximum number of concurrent transactions has been reached.

Class

DbTxnMgr

See Also

DbTxnMgr::begin, DbTxnMgr::checkpoint, DbTxnMgr::close, DbTxnMgr::open, DbTxnMgr::stat and DbTxnMgr::unlink.