| 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->abort()</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="txnstat_print.html" title="DB_ENV->txn_stat_print()" /> |
| 12 | <link rel="next" href="txncommit.html" title="DB_TXN->commit()" /> |
| 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">DB_TXN->abort()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="txnstat_print.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 12. |
| 26 | The DB_TXN Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="txncommit.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="txnabort"></a>DB_TXN->abort()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_TXN->abort(DB_TXN *tid); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DB_TXN->abort()</code> method causes an abnormal termination of the |
| 47 | transaction. The log is played backward, and any necessary undo |
| 48 | operations are done through the <span class="bold"><strong>tx_recover</strong></span> |
| 49 | function specified to <a class="xref" href="envset_app_dispatch.html" title="DB_ENV->set_app_dispatch()">DB_ENV->set_app_dispatch()</a>. |
| 50 | Before <code class="methodname">DB_TXN->abort()</code> returns, any locks held by the transaction |
| 51 | will have been released. |
| 52 | </p> |
| 53 | <p> |
| 54 | In the case of nested transactions, aborting a parent transaction |
| 55 | causes all children (unresolved or not) of the parent transaction to |
| 56 | be aborted. |
| 57 | </p> |
| 58 | <p> |
| 59 | All cursors opened within the transaction must be closed before the |
| 60 | transaction is aborted. |
| 61 | If they are not closed, they will be closed by |
| 62 | this function. If a close operation fails, the rest |
| 63 | of the cursors are closed, and the database environment is set to the panic state. |
| 64 | </p> |
| 65 | <p> |
| 66 | After <code class="methodname">DB_TXN->abort()</code> has been called, regardless of its return, the |
| 67 | <a class="link" href="txn.html" title="Chapter 12. The DB_TXN Handle">DB_TXN</a> handle may not be |
| 68 | accessed again. |
| 69 | </p> |
| 70 | <p> |
| 71 | The <code class="methodname">DB_TXN->abort()</code> <span> |
| 72 | <span> |
| 73 | method returns a non-zero error value on failure and 0 on success. |
| 74 | </span> |
| 75 | |
| 76 | </span> |
| 77 | </p> |
| 78 | <div class="sect2" lang="en" xml:lang="en"> |
| 79 | <div class="titlepage"> |
| 80 | <div> |
| 81 | <div> |
| 82 | <h3 class="title"><a id="idp54926880"></a>Class</h3> |
| 83 | </div> |
| 84 | </div> |
| 85 | </div> |
| 86 | <p> |
| 87 | <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> |
| 88 | </p> |
| 89 | </div> |
| 90 | <div class="sect2" lang="en" xml:lang="en"> |
| 91 | <div class="titlepage"> |
| 92 | <div> |
| 93 | <div> |
| 94 | <h3 class="title"><a id="idp54928008"></a>See Also</h3> |
| 95 | </div> |
| 96 | </div> |
| 97 | </div> |
| 98 | <p> |
| 99 | <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> |
| 100 | </p> |
| 101 | </div> |
| 102 | </div> |
| 103 | <div class="navfooter"> |
| 104 | <hr /> |
| 105 | <table width="100%" summary="Navigation footer"> |
| 106 | <tr> |
| 107 | <td width="40%" align="left"><a accesskey="p" href="txnstat_print.html">Prev</a> </td> |
| 108 | <td width="20%" align="center"> |
| 109 | <a accesskey="u" href="txn.html">Up</a> |
| 110 | </td> |
| 111 | <td width="40%" align="right"> <a accesskey="n" href="txncommit.html">Next</a></td> |
| 112 | </tr> |
| 113 | <tr> |
| 114 | <td width="40%" align="left" valign="top">DB_ENV->txn_stat_print() </td> |
| 115 | <td width="20%" align="center"> |
| 116 | <a accesskey="h" href="index.html">Home</a> |
| 117 | </td> |
| 118 | <td width="40%" align="right" valign="top"> DB_TXN->commit()</td> |
| 119 | </tr> |
| 120 | </table> |
| 121 | </div> |
| 122 | </body> |
| 123 | </html> |