• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/db-4.8.30/docs/api_reference/C/
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4  <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6    <title>DB_TXN-&gt;prepare()</title>
7    <link rel="stylesheet" href="apiReference.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9    <link rel="start" href="index.html" title="Berkeley DB C API Reference" />
10    <link rel="up" href="txn.html" title="Chapter��12.�� The DB_TXN Handle" />
11    <link rel="prev" href="txnid.html" title="DB_TXN-&gt;id()" />
12    <link rel="next" href="txnrecover.html" title="DB_ENV-&gt;txn_recover()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DB_TXN-&gt;prepare()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="txnid.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��12.��
23                The DB_TXN Handle 
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="txnrecover.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="txnprepare"></a>DB_TXN-&gt;prepare()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int
41DB_TXN-&gt;prepare(DB_TXN *tid, u_int8_t gid[DB_XIDDATASIZE]);  </pre>
42      <p>
43         The <code class="methodname">DB_TXN-&gt;prepare()</code> method initiates the beginning of a two-phase
44         commit.
45    </p>
46      <p>
47         In a distributed transaction environment, Berkeley DB can be used as a
48         local transaction manager.  In this case, the distributed transaction
49         manager must send <span class="emphasis"><em>prepare</em></span> messages to each local
50         manager.  The local manager must then issue a <code class="methodname">DB_TXN-&gt;prepare()</code> and
51         await its successful return before responding to the distributed
52         transaction manager.  Only after the distributed transaction manager
53         receives successful responses from all of its
54         <span class="emphasis"><em>prepare</em></span> messages should it issue any
55         <span class="emphasis"><em>commit</em></span> messages.
56    </p>
57      <p>
58         In the case of nested transactions, preparing the parent causes all
59         unresolved children of the parent transaction to be committed.  Child
60         transactions should never be explicitly prepared.  Their fate will be
61         resolved along with their parent's during global recovery.
62    </p>
63      <p>
64         The <code class="methodname">DB_TXN-&gt;prepare()</code> <span>
65            <span>
66                  method returns a non-zero error value on failure and 0 on success.
67            </span>
68            
69        </span>
70    </p>
71      <div class="sect2" lang="en" xml:lang="en">
72        <div class="titlepage">
73          <div>
74            <div>
75              <h3 class="title"><a id="id1709775"></a>Parameters</h3>
76            </div>
77          </div>
78        </div>
79        <div class="sect3" lang="en" xml:lang="en">
80          <div class="titlepage">
81            <div>
82              <div>
83                <h4 class="title"><a id="id1709784"></a>gid</h4>
84              </div>
85            </div>
86          </div>
87          <p>
88                          The <span class="bold"><strong>gid</strong></span> parameter specifies the
89                          global transaction ID by which this transaction will be known.  This
90                          global transaction ID will be returned in calls
91                          to <a class="xref" href="txnrecover.html" title="DB_ENV-&gt;txn_recover()">DB_ENV-&gt;txn_recover()</a>
92                          telling the application which global transactions must be resolved.
93                     </p>
94        </div>
95      </div>
96      <div class="sect2" lang="en" xml:lang="en">
97        <div class="titlepage">
98          <div>
99            <div>
100              <h3 class="title"><a id="id1709682"></a>Class</h3>
101            </div>
102          </div>
103        </div>
104        <p>
105                 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>, <a class="link" href="txn.html" title="Chapter��12.�� The DB_TXN Handle">DB_TXN</a> 
106            </p>
107      </div>
108      <div class="sect2" lang="en" xml:lang="en">
109        <div class="titlepage">
110          <div>
111            <div>
112              <h3 class="title"><a id="id1709837"></a>See Also</h3>
113            </div>
114          </div>
115        </div>
116        <p>
117                     <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> 
118                </p>
119      </div>
120    </div>
121    <div class="navfooter">
122      <hr />
123      <table width="100%" summary="Navigation footer">
124        <tr>
125          <td width="40%" align="left"><a accesskey="p" href="txnid.html">Prev</a>��</td>
126          <td width="20%" align="center">
127            <a accesskey="u" href="txn.html">Up</a>
128          </td>
129          <td width="40%" align="right">��<a accesskey="n" href="txnrecover.html">Next</a></td>
130        </tr>
131        <tr>
132          <td width="40%" align="left" valign="top">DB_TXN-&gt;id()��</td>
133          <td width="20%" align="center">
134            <a accesskey="h" href="index.html">Home</a>
135          </td>
136          <td width="40%" align="right" valign="top">��DB_ENV-&gt;txn_recover()</td>
137        </tr>
138      </table>
139    </div>
140  </body>
141</html>
142