-I*Berkeley DB: DbTxn::prepare[P

DbTxn::prepare





#include <db_cxx.h>

intDbTxn::prepare();





Description



HThe DbTxn::prepare method initiates the beginning of a two-phase commit.

LIn a distributed transaction environment, Berkeley DB can be used as a localGtransaction manager. In this case, the distributed transaction managerCmust send prepare messages to each local manager. The localAmanager must then issue a DbTxn::prepare and await its successfulFreturn before responding to the distributed transaction manager. OnlyGafter the distributed transaction manager receives successful responses;from all of its prepare messages should it issue anycommit messages.

The DbTxn::prepare>method either returns errno or throws an exception that:encapsulates an errno on failure, and 0 on success.



Errors

UIf a fatal error occurs in Berkeley DB, the DbTxn::prepare method may fail and eitherIreturn DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY,Gat which point all subsequent database calls will also fail in the sameFway. Methods marked as returning errno will, by default, throwHan exception that encapsulates the error information. The default error\behavior can be changed, see DbException.

The DbTxn::prepare&method may fail and throw an exceptionKfor 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),6DbLog::put, malloc(3), memcpy(3), memset(3), strerror(3), vfprintf(3),and vsnprintf(3).



Class

2DbTxn



See Also

:DbTxn::abort,<DbTxn::commit,3DbTxn::idandDbTxn::prepare.
ÿÿ