,I&Berkeley DB: txn_commit[P

txn_commit





#include <db.h>

inttxn_commit(DB_TXN *tid);





Description



HThe txn_commit function ends the transaction specified by the tid argument.

FIf DB_TXN_NOSYNC was not specified, a commit log record is written and;flushed to disk, as are all previously written log records.

BIf the transaction is nested, its locks are acquired by the parent.transaction, otherwise its locks are released.7Note: nested transactions are not yet supported.

GAny applications that require strict two-phase locking must not releaseDany locks explicitly, leaving them all to be released by txn_commit.

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



Errors

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

The txn_commit)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), getpid(3),6lock_vec,1log_put, malloc(3), memcpy(3), memset(3), strerror(3), vfprintf(3),and vsnprintf(3).

In addition, the txn_commit)function may fail and return errnofor the following conditions:

5

EINVAL
The transaction was already aborted.




See Also

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