,I%Berkeley DB: txn_begin[P

txn_begin





#include <db.h>

int6txn_begin(DB_TXNMGR *txnp, DB_TXN *pid, DB_TXN **tid);





Description



5The txn_begin method creates a new transaction in thetransaction manager,Icopying a pointer to a DB_TXN that uniquely identifies it into the memoryreferenced by tid.

FNote: transactions may not span threads, i.e., each transactionGmust begin and end in the same thread, and each transaction may only beused by a single thread.

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

CNote: transactions may not currently be nested. In a futureHrevision of Berkeley DB, if the pid argument is non-NULL, the newHtransaction will be a nested transaction, with the transaction indicatedby pid as its parent.

The txn_beginHfunction returns the value of errno on failure, and 0 on success.



Errors

RIf a fatal error occurs in Berkeley DB, the txn_begin function may fail and returnFDB_RUNRECOVERY, at which point all subsequent database calls will alsoreturn DB_RUNRECOVERY.

The txn_begin)function may fail and return errnoKfor 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),1log_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 txn_begin)function may fail and return errnofor the following conditions:

P

ENOSPC
The maximum number of concurrent transactions has been reached.




See Also

5txn_abort, txn_begin,Btxn_checkpoint,8txn_close,7txn_commit,/txn_id,6txn_open,9txn_prepare,5txn_statand:txn_unlink.
ÿÿ