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>Chapter 12. The DB_TXN Handle</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="index.html" title="Berkeley DB C API Reference" /> 11 <link rel="prev" href="seqstat_print.html" title="DB_SEQUENCE->stat_print()" /> 12 <link rel="next" href="dbget_transactional.html" title="DB->get_transactional()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Chapter 12. 19 The DB_TXN Handle 20 </th> 21 </tr> 22 <tr> 23 <td width="20%" align="left"><a accesskey="p" href="seqstat_print.html">Prev</a> </td> 24 <th width="60%" align="center"> </th> 25 <td width="20%" align="right"> <a accesskey="n" href="dbget_transactional.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="chapter" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title"><a id="txn"></a>Chapter 12. 35 The DB_TXN Handle 36 </h2> 37 </div> 38 </div> 39 </div> 40 <pre class="programlisting">#include <db.h> 41 42typedef struct __db_txn DB_TXN; </pre> 43 <p> 44 The <code class="classname">DB_TXN</code> object is the handle for a transaction. Methods of 45 the <code class="classname">DB_TXN</code> handle are used to configure, abort and commit the 46 transaction. <code class="classname">DB_TXN</code> handles are provided to 47 <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a> methods in order 48 to transactionally protect those database operations. 49 </p> 50 <p> 51 <code class="classname">DB_TXN</code> handles are not free-threaded; transactions handles 52 may be used by multiple threads, but only serially, that is, the application must 53 serialize access to the <code class="classname">DB_TXN</code> handle. Once the 54 <a class="xref" href="txnabort.html" title="DB_TXN->abort()">DB_TXN->abort()</a> or 55 <a class="xref" href="txncommit.html" title="DB_TXN->commit()">DB_TXN->commit()</a> methods are called, the handle 56 may not be accessed again, regardless of the method's return. In addition, parent 57 transactions may not issue any Berkeley DB operations while they have active child 58 transactions (child transactions that have not yet been committed or aborted) except for 59 <a class="xref" href="txnbegin.html" title="DB_ENV->txn_begin()">DB_ENV->txn_begin()</a>, 60 <a class="xref" href="txnabort.html" title="DB_TXN->abort()">DB_TXN->abort()</a> and 61 <a class="xref" href="txncommit.html" title="DB_TXN->commit()">DB_TXN->commit()</a>. 62 </p> 63 <div class="sect1" lang="en" xml:lang="en"> 64 <div class="titlepage"> 65 <div> 66 <div> 67 <h2 class="title" style="clear: both"><a id="txnlist"></a>Transaction Subsystem and Related Methods</h2> 68 </div> 69 </div> 70 </div> 71 <div class="navtable"> 72 <table border="1" width="80%"> 73 <thead> 74 <tr> 75 <th>Transaction Subsystem and Related Methods</th> 76 <th>Description</th> 77 </tr> 78 </thead> 79 <tbody> 80 <tr> 81 <td> 82 <a class="xref" href="txncheckpoint.html" title="DB_ENV->txn_checkpoint()">DB_ENV->txn_checkpoint()</a> 83 </td> 84 <td>Checkpoint the transaction subsystem</td> 85 </tr> 86 <tr> 87 <td> 88 <a class="xref" href="txnrecover.html" title="DB_ENV->txn_recover()">DB_ENV->txn_recover()</a> 89 </td> 90 <td>Distributed transaction recovery</td> 91 </tr> 92 <tr> 93 <td> 94 <a class="xref" href="txnset_timeout.html" title="DB_TXN->set_timeout()">DB_TXN->set_timeout()</a> 95 </td> 96 <td>Set transaction timeout</td> 97 </tr> 98 <tr> 99 <td> 100 <a class="xref" href="txnstat.html" title="DB_ENV->txn_stat()">DB_ENV->txn_stat()</a> 101 </td> 102 <td>Return transaction subsystem statistics</td> 103 </tr> 104 <tr> 105 <td> 106 <a class="xref" href="txnstat_print.html" title="DB_ENV->txn_stat_print()">DB_ENV->txn_stat_print()</a> 107 </td> 108 <td>Print transaction subsystem statistics</td> 109 </tr> 110 <tr> 111 <td colspan="2"> 112 <span class="bold"> 113 <strong>Transaction Subsystem Configuration</strong> 114 </span> 115 </td> 116 </tr> 117 <tr> 118 <td><a class="xref" href="envset_timeout.html" title="DB_ENV->set_timeout()">DB_ENV->set_timeout()</a>, <a class="xref" href="envget_timeout.html" title="DB_ENV->get_timeout()">DB_ENV->get_timeout()</a></td> 119 <td>Set/get lock and transaction timeout</td> 120 </tr> 121 <tr> 122 <td> 123 <a class="xref" href="dbget_transactional.html" title="DB->get_transactional()">DB->get_transactional()</a> 124 </td> 125 <td>Does the DB have transaction support</td> 126 </tr> 127 <tr> 128 <td> 129 <a class="xref" href="envcdsgroup_begin.html" title="DB_ENV->cdsgroup_begin()">DB_ENV->cdsgroup_begin()</a> 130 </td> 131 <td>Get a locker ID in Berkeley DB Concurrent Data Store</td> 132 </tr> 133 <tr> 134 <td><a class="xref" href="envset_tx_max.html" title="DB_ENV->set_tx_max()">DB_ENV->set_tx_max()</a>, <a class="xref" href="envget_tx_max.html" title="DB_ENV->get_tx_max()">DB_ENV->get_tx_max()</a></td> 135 <td>Set/get maximum number of transactions</td> 136 </tr> 137 <tr> 138 <td><a class="xref" href="envset_tx_timestamp.html" title="DB_ENV->set_tx_timestamp()">DB_ENV->set_tx_timestamp()</a>, <a class="xref" href="envget_tx_timestamp.html" title="DB_ENV->get_tx_timestamp()">DB_ENV->get_tx_timestamp()</a></td> 139 <td>Set/get recovery timestamp</td> 140 </tr> 141 <tr> 142 <td colspan="2"> 143 <span class="bold"> 144 <strong>Transaction Operations</strong> 145 </span> 146 </td> 147 </tr> 148 <tr> 149 <td> 150 <a class="xref" href="txnabort.html" title="DB_TXN->abort()">DB_TXN->abort()</a> 151 </td> 152 <td>Abort a transaction</td> 153 </tr> 154 <tr> 155 <td> 156 <a class="xref" href="txnbegin.html" title="DB_ENV->txn_begin()">DB_ENV->txn_begin()</a> 157 </td> 158 <td>Begin a transaction</td> 159 </tr> 160 <tr> 161 <td> 162 <a class="xref" href="txncommit.html" title="DB_TXN->commit()">DB_TXN->commit()</a> 163 </td> 164 <td>Commit a transaction</td> 165 </tr> 166 <tr> 167 <td> 168 <a class="xref" href="txndiscard.html" title="DB_TXN->discard()">DB_TXN->discard()</a> 169 </td> 170 <td>Discard a prepared but not resolved transaction handle</td> 171 </tr> 172 <tr> 173 <td> 174 <a class="xref" href="txnid.html" title="DB_TXN->id()">DB_TXN->id()</a> 175 </td> 176 <td>Return a transaction's ID</td> 177 </tr> 178 <tr> 179 <td> 180 <a class="xref" href="txnprepare.html" title="DB_TXN->prepare()">DB_TXN->prepare()</a> 181 </td> 182 <td>Prepare a transaction for commit</td> 183 </tr> 184 <tr> 185 <td><a class="xref" href="txnset_name.html" title="DB_TXN->set_name()">DB_TXN->set_name()</a>, <a class="xref" href="txnget_name.html" title="DB_TXN->get_name()">DB_TXN->get_name()</a></td> 186 <td>Associate a string with a transaction</td> 187 </tr> 188 </tbody> 189 </table> 190 </div> 191 </div> 192 </div> 193 <div class="navfooter"> 194 <hr /> 195 <table width="100%" summary="Navigation footer"> 196 <tr> 197 <td width="40%" align="left"><a accesskey="p" href="seqstat_print.html">Prev</a> </td> 198 <td width="20%" align="center"> </td> 199 <td width="40%" align="right"> <a accesskey="n" href="dbget_transactional.html">Next</a></td> 200 </tr> 201 <tr> 202 <td width="40%" align="left" valign="top">DB_SEQUENCE->stat_print() </td> 203 <td width="20%" align="center"> 204 <a accesskey="h" href="index.html">Home</a> 205 </td> 206 <td width="40%" align="right" valign="top"> DB->get_transactional()</td> 207 </tr> 208 </table> 209 </div> 210 </body> 211</html> 212