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>DbTxn::discard()</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 13. The DbTxn Handle" /> 11 <link rel="prev" href="txncommit.html" title="DbTxn::commit()" /> 12 <link rel="next" href="txnget_name.html" title="DbTxn::get_name()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbTxn::discard()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="txncommit.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 13. 23 The DbTxn Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="txnget_name.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="txndiscard"></a>DbTxn::discard()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbTxn::discard(u_int32_t flags);</pre> 42 <p> 43 The <code class="methodname">DbTxn::discard()</code> method frees up all the per-process resources 44 associated with the specified <a class="link" href="txn.html" title="Chapter 13. The DbTxn Handle">DbTxn</a> handle, neither 45 committing nor aborting the transaction. This call may be used only 46 after calls to <a class="xref" href="txnrecover.html" title="DbEnv::txn_recover()">DbEnv::txn_recover()</a> when 47 there are multiple global transaction managers recovering transactions 48 in a single Berkeley DB environment. Any transactions returned by 49 <a class="xref" href="txnrecover.html" title="DbEnv::txn_recover()">DbEnv::txn_recover()</a> 50 that are not handled by the current global transaction manager should 51 be discarded using <code class="methodname">DbTxn::discard()</code>. 52 </p> 53 <p> 54 The <code class="methodname">DbTxn::discard()</code> <span> 55 56 <span> 57 method either returns a non-zero error value or throws an 58 exception that encapsulates a non-zero error value on 59 failure, and returns 0 on success. 60 </span> 61 </span> 62 </p> 63 <p> 64 After <code class="methodname">DbTxn::discard()</code> has been called, regardless of its return, 65 the <a class="link" href="txn.html" title="Chapter 13. The DbTxn Handle">DbTxn</a> handle may not 66 be accessed again. 67 </p> 68 <div class="sect2" lang="en" xml:lang="en"> 69 <div class="titlepage"> 70 <div> 71 <div> 72 <h3 class="title"><a id="id1714451"></a>Parameters</h3> 73 </div> 74 </div> 75 </div> 76 <div class="sect3" lang="en" xml:lang="en"> 77 <div class="titlepage"> 78 <div> 79 <div> 80 <h4 class="title"><a id="id1714351"></a>flags</h4> 81 </div> 82 </div> 83 </div> 84 <p> 85 The <span class="bold"><strong>flags</strong></span> parameter is currently 86 unused, and must be set to 0. 87 </p> 88 </div> 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="id1714707"></a>Errors</h3> 95 </div> 96 </div> 97 </div> 98 <p> 99 The <code class="methodname">DbTxn::discard()</code> <span> 100 101 <span> 102 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 103 exception, encapsulating one of the following non-zero errors, or return one 104 of the following non-zero errors: 105 </span> 106 </span> 107 </p> 108 <div class="sect3" lang="en" xml:lang="en"> 109 <div class="titlepage"> 110 <div> 111 <div> 112 <h4 class="title"><a id="id1714438"></a>EINVAL</h4> 113 </div> 114 </div> 115 </div> 116 <p> 117 If the transaction handle does not refer to a transaction that was 118 recovered into a prepared but not yet completed state; or if an 119 invalid flag value or parameter was specified. 120 </p> 121 </div> 122 </div> 123 <div class="sect2" lang="en" xml:lang="en"> 124 <div class="titlepage"> 125 <div> 126 <div> 127 <h3 class="title"><a id="id1714656"></a>Class</h3> 128 </div> 129 </div> 130 </div> 131 <p> 132 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>, <a class="link" href="txn.html" title="Chapter 13. The DbTxn Handle">DbTxn</a> 133 </p> 134 </div> 135 <div class="sect2" lang="en" xml:lang="en"> 136 <div class="titlepage"> 137 <div> 138 <div> 139 <h3 class="title"><a id="id1714567"></a>See Also</h3> 140 </div> 141 </div> 142 </div> 143 <p> 144 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> 145 </p> 146 </div> 147 </div> 148 <div class="navfooter"> 149 <hr /> 150 <table width="100%" summary="Navigation footer"> 151 <tr> 152 <td width="40%" align="left"><a accesskey="p" href="txncommit.html">Prev</a> </td> 153 <td width="20%" align="center"> 154 <a accesskey="u" href="txn.html">Up</a> 155 </td> 156 <td width="40%" align="right"> <a accesskey="n" href="txnget_name.html">Next</a></td> 157 </tr> 158 <tr> 159 <td width="40%" align="left" valign="top">DbTxn::commit() </td> 160 <td width="20%" align="center"> 161 <a accesskey="h" href="index.html">Home</a> 162 </td> 163 <td width="40%" align="right" valign="top"> DbTxn::get_name()</td> 164 </tr> 165 </table> 166 </div> 167 </body> 168</html> 169