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