| 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 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">DbTxn::discard()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="txncommit.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 13. |
| 26 | The DbTxn Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="txnget_name.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="txndiscard"></a>DbTxn::discard()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbTxn::discard(u_int32_t flags);</pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DbTxn::discard()</code> method frees up all the per-process resources |
| 47 | associated with the specified <a class="link" href="txn.html" title="Chapter 13. The DbTxn Handle">DbTxn</a> handle, neither |
| 48 | committing nor aborting the transaction. This call may be used only |
| 49 | after calls to <a class="xref" href="txnrecover.html" title="DbEnv::txn_recover()">DbEnv::txn_recover()</a> when |
| 50 | there are multiple global transaction managers recovering transactions |
| 51 | in a single Berkeley DB environment. Any transactions returned by |
| 52 | <a class="xref" href="txnrecover.html" title="DbEnv::txn_recover()">DbEnv::txn_recover()</a> |
| 53 | that are not handled by the current global transaction manager should |
| 54 | be discarded using <code class="methodname">DbTxn::discard()</code>. |
| 55 | </p> |
| 56 | <p> |
| 57 | All open cursors in the transaction are closed and the |
| 58 | first cursor close error, if any, is returned. |
| 59 | </p> |
| 60 | <p> |
| 61 | The <code class="methodname">DbTxn::discard()</code> <span> |
| 62 | |
| 63 | <span> |
| 64 | method either returns a non-zero error value or throws an |
| 65 | exception that encapsulates a non-zero error value on |
| 66 | failure, and returns 0 on success. |
| 67 | </span> |
| 68 | </span> |
| 69 | |
| 70 | The errors values that this method returns include the error values of <code class="methodname">Dbc::close()</code> and the following: |
| 71 | |
| 72 | </p> |
| 73 | <div class="sect3" lang="en" xml:lang="en"> |
| 74 | <div class="titlepage"> |
| 75 | <div> |
| 76 | <div> |
| 77 | <h4 class="title"><a id="idp10458480"></a><span>DbDeadlockException or </span>DB_LOCK_DEADLOCK</h4> |
| 78 | </div> |
| 79 | </div> |
| 80 | </div> |
| 81 | <p> |
| 82 | A transactional database environment operation was selected to resolve |
| 83 | a deadlock. |
| 84 | </p> |
| 85 | <p> |
| 86 | <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if |
| 87 | your Berkeley DB API is configured to throw exceptions. |
| 88 | Otherwise, <code class="literal">DB_LOCK_DEADLOCK</code> is returned. |
| 89 | </p> |
| 90 | </div> |
| 91 | <div class="sect3" lang="en" xml:lang="en"> |
| 92 | <div class="titlepage"> |
| 93 | <div> |
| 94 | <div> |
| 95 | <h4 class="title"><a id="idp10448480"></a><span>DbLockNotGrantedException or </span>DB_LOCK_NOTGRANTED</h4> |
| 96 | </div> |
| 97 | </div> |
| 98 | </div> |
| 99 | <p> |
| 100 | A Berkeley DB Concurrent Data Store database environment configured |
| 101 | for lock timeouts was unable to grant a lock in the allowed time. |
| 102 | </p> |
| 103 | <p> |
| 104 | You attempted to open a database handle that is configured |
| 105 | for no waiting exclusive locking, but the exclusive lock could not be |
| 106 | immediately obtained. See |
| 107 | <a class="xref" href="dbset_lk_exclusive.html" title="Db::set_lk_exclusive()">Db::set_lk_exclusive()</a> |
| 108 | for more information. |
| 109 | </p> |
| 110 | <p> |
| 111 | <a class="xref" href="dblocknotgranted.html" title="DbLockNotGrantedException">DbLockNotGrantedException</a> is thrown if |
| 112 | your Berkeley DB API is configured to throw exceptions. |
| 113 | Otherwise, <code class="literal">DB_LOCK_NOTGRANTED</code> is returned. |
| 114 | </p> |
| 115 | </div> |
| 116 | <div class="sect3" lang="en" xml:lang="en"> |
| 117 | <div class="titlepage"> |
| 118 | <div> |
| 119 | <div> |
| 120 | <h4 class="title"><a id="idp10449512"></a>EINVAL</h4> |
| 121 | </div> |
| 122 | </div> |
| 123 | </div> |
| 124 | <p> |
| 125 | If the cursor is already closed; or if an invalid flag value or parameter was specified. |
| 126 | </p> |
| 127 | </div> |
| 128 | <p> |
| 129 | After <code class="methodname">DbTxn::discard()</code> has been called, regardless of its return, |
| 130 | the <a class="link" href="txn.html" title="Chapter 13. The DbTxn Handle">DbTxn</a> handle may not |
| 131 | be accessed again. |
| 132 | </p> |
| 133 | <div class="sect2" lang="en" xml:lang="en"> |
| 134 | <div class="titlepage"> |
| 135 | <div> |
| 136 | <div> |
| 137 | <h3 class="title"><a id="idp10470824"></a>Parameters</h3> |
| 138 | </div> |
| 139 | </div> |
| 140 | </div> |
| 141 | <div class="sect3" lang="en" xml:lang="en"> |
| 142 | <div class="titlepage"> |
| 143 | <div> |
| 144 | <div> |
| 145 | <h4 class="title"><a id="idp10471016"></a>flags</h4> |
| 146 | </div> |
| 147 | </div> |
| 148 | </div> |
| 149 | <p> |
| 150 | The <span class="bold"><strong>flags</strong></span> parameter is currently |
| 151 | unused, and must be set to 0. |
| 152 | </p> |
| 153 | </div> |
| 154 | </div> |
| 155 | <div class="sect2" lang="en" xml:lang="en"> |
| 156 | <div class="titlepage"> |
| 157 | <div> |
| 158 | <div> |
| 159 | <h3 class="title"><a id="idp10440616"></a>Errors</h3> |
| 160 | </div> |
| 161 | </div> |
| 162 | </div> |
| 163 | <p> |
| 164 | The <code class="methodname">DbTxn::discard()</code> <span> |
| 165 | |
| 166 | <span> |
| 167 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 168 | exception, encapsulating one of the following non-zero errors, or return one |
| 169 | of the following non-zero errors: |
| 170 | </span> |
| 171 | </span> |
| 172 | </p> |
| 173 | <div class="sect3" lang="en" xml:lang="en"> |
| 174 | <div class="titlepage"> |
| 175 | <div> |
| 176 | <div> |
| 177 | <h4 class="title"><a id="idp10473640"></a>EINVAL</h4> |
| 178 | </div> |
| 179 | </div> |
| 180 | </div> |
| 181 | <p> |
| 182 | If the transaction handle does not refer to a transaction that was |
| 183 | recovered into a prepared but not yet completed state; or if an |
| 184 | invalid flag value or parameter was specified. |
| 185 | </p> |
| 186 | </div> |
| 187 | </div> |
| 188 | <div class="sect2" lang="en" xml:lang="en"> |
| 189 | <div class="titlepage"> |
| 190 | <div> |
| 191 | <div> |
| 192 | <h3 class="title"><a id="idp10472560"></a>Class</h3> |
| 193 | </div> |
| 194 | </div> |
| 195 | </div> |
| 196 | <p> |
| 197 | <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> |
| 198 | </p> |
| 199 | </div> |
| 200 | <div class="sect2" lang="en" xml:lang="en"> |
| 201 | <div class="titlepage"> |
| 202 | <div> |
| 203 | <div> |
| 204 | <h3 class="title"><a id="idp10446304"></a>See Also</h3> |
| 205 | </div> |
| 206 | </div> |
| 207 | </div> |
| 208 | <p> |
| 209 | <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> |
| 210 | </p> |
| 211 | </div> |
| 212 | </div> |
| 213 | <div class="navfooter"> |
| 214 | <hr /> |
| 215 | <table width="100%" summary="Navigation footer"> |
| 216 | <tr> |
| 217 | <td width="40%" align="left"><a accesskey="p" href="txncommit.html">Prev</a> </td> |
| 218 | <td width="20%" align="center"> |
| 219 | <a accesskey="u" href="txn.html">Up</a> |
| 220 | </td> |
| 221 | <td width="40%" align="right"> <a accesskey="n" href="txnget_name.html">Next</a></td> |
| 222 | </tr> |
| 223 | <tr> |
| 224 | <td width="40%" align="left" valign="top">DbTxn::commit() </td> |
| 225 | <td width="20%" align="center"> |
| 226 | <a accesskey="h" href="index.html">Home</a> |
| 227 | </td> |
| 228 | <td width="40%" align="right" valign="top"> DbTxn::get_name()</td> |
| 229 | </tr> |
| 230 | </table> |
| 231 | </div> |
| 232 | </body> |
| 233 | </html> |