66 lines
2.9 KiB
HTML
66 lines
2.9 KiB
HTML
<!--$Id: txn_prepare.html 63573 2008-05-23 21:43:21Z trent.nelson $-->
|
|
<!--Copyright (c) 1997,2008 Oracle. All rights reserved.-->
|
|
<!--See the file LICENSE for redistribution information.-->
|
|
<html>
|
|
<head>
|
|
<title>Berkeley DB: DbTxn::prepare</title>
|
|
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
|
|
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
|
|
</head>
|
|
<body bgcolor=white>
|
|
<table width="100%"><tr valign=top>
|
|
<td>
|
|
<b>DbTxn::prepare</b>
|
|
</td>
|
|
<td align=right>
|
|
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
|
|
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
|
|
</tr></table>
|
|
<hr size=1 noshade>
|
|
<tt>
|
|
<b><pre>
|
|
#include <db_cxx.h>
|
|
<p>
|
|
int
|
|
DbTxn::prepare(u_int8_t gid[DB_XIDDATASIZE]);
|
|
</pre></b>
|
|
<hr size=1 noshade>
|
|
<b>Description: DbTxn::prepare</b>
|
|
<a name="2"><!--meow--></a>
|
|
<p>The DbTxn::prepare method initiates the beginning of a two-phase commit.</p>
|
|
<p>In a distributed transaction environment, Berkeley DB can be used as a local
|
|
transaction manager. In this case, the distributed transaction manager
|
|
must send <i>prepare</i> messages to each local manager. The local
|
|
manager must then issue a DbTxn::prepare and await its successful
|
|
return before responding to the distributed transaction manager. Only
|
|
after the distributed transaction manager receives successful responses
|
|
from all of its <i>prepare</i> messages should it issue any
|
|
<i>commit</i> messages.</p>
|
|
<p>In the case of nested transactions, preparing the parent causes all
|
|
unresolved children of the parent transaction to be committed. Child
|
|
transactions should never be explicitly prepared. Their fate will be
|
|
resolved along with their parent's during global recovery.</p>
|
|
<p>The DbTxn::prepare 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.
|
|
</p>
|
|
<b>Parameters</b> <br>
|
|
<b>gid</b><ul compact><li>The <b>gid</b> parameter specifies the global transaction ID by which this
|
|
transaction will be known. This global transaction ID will be returned
|
|
in calls to <a href="../api_cxx/txn_recover.html">DbEnv::txn_recover</a>, telling the application which global
|
|
transactions must be resolved.</ul>
|
|
<br>
|
|
<hr size=1 noshade>
|
|
<br><b>Class</b>
|
|
<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/txn_class.html">DbTxn</a>
|
|
<br><b>See Also</b>
|
|
<a href="../api_cxx/txn_list.html">Transaction Subsystem and Related Methods</a>
|
|
</tt>
|
|
<table width="100%"><tr><td><br></td><td align=right>
|
|
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
|
|
</td></tr></table>
|
|
<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font>
|
|
</body>
|
|
</html>
|