| 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->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 12. The DB_TXN Handle" /> |
| 11 | <link rel="prev" href="txncommit.html" title="DB_TXN->commit()" /> |
| 12 | <link rel="next" href="txnget_name.html" title="DB_TXN->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">DB_TXN->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 12. |
| 26 | The DB_TXN 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>DB_TXN->discard()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_TXN->discard(DB_TXN *tid, u_int32_t flags); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DB_TXN->discard()</code> method frees up all the per-process resources |
| 47 | associated with the specified <a class="link" href="txn.html" title="Chapter 12. The DB_TXN Handle">DB_TXN</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="DB_ENV->txn_recover()">DB_ENV->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="DB_ENV->txn_recover()">DB_ENV->txn_recover()</a> |
| 53 | that are not handled by the current global transaction manager should |
| 54 | be discarded using <code class="methodname">DB_TXN->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">DB_TXN->discard()</code> <span> |
| 62 | <span> |
| 63 | method returns a non-zero error value on failure and 0 on success. |
| 64 | </span> |
| 65 | |
| 66 | </span> |
| 67 | |
| 68 | The errors values that this method returns include the error values of <code class="methodname">DBcursor->close()</code> and the following: |
| 69 | |
| 70 | </p> |
| 71 | <div class="sect3" lang="en" xml:lang="en"> |
| 72 | <div class="titlepage"> |
| 73 | <div> |
| 74 | <div> |
| 75 | <h4 class="title"><a id="idp54949872"></a>DB_LOCK_DEADLOCK</h4> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | <p> |
| 80 | A transactional database environment operation was selected to resolve |
| 81 | a deadlock. |
| 82 | </p> |
| 83 | </div> |
| 84 | <div class="sect3" lang="en" xml:lang="en"> |
| 85 | <div class="titlepage"> |
| 86 | <div> |
| 87 | <div> |
| 88 | <h4 class="title"><a id="idp54930560"></a>DB_LOCK_NOTGRANTED</h4> |
| 89 | </div> |
| 90 | </div> |
| 91 | </div> |
| 92 | <p> |
| 93 | A Berkeley DB Concurrent Data Store database environment configured |
| 94 | for lock timeouts was unable to grant a lock in the allowed time. |
| 95 | </p> |
| 96 | <p> |
| 97 | You attempted to open a database handle that is configured |
| 98 | for no waiting exclusive locking, but the exclusive lock could not be |
| 99 | immediately obtained. See |
| 100 | <a class="xref" href="dbset_lk_exclusive.html" title="DB->set_lk_exclusive()">DB->set_lk_exclusive()</a> |
| 101 | for more information. |
| 102 | </p> |
| 103 | </div> |
| 104 | <div class="sect3" lang="en" xml:lang="en"> |
| 105 | <div class="titlepage"> |
| 106 | <div> |
| 107 | <div> |
| 108 | <h4 class="title"><a id="idp54939656"></a>EINVAL</h4> |
| 109 | </div> |
| 110 | </div> |
| 111 | </div> |
| 112 | <p> |
| 113 | If the cursor is already closed; or if an invalid flag value or parameter was specified. |
| 114 | </p> |
| 115 | </div> |
| 116 | <p> |
| 117 | After <code class="methodname">DB_TXN->discard()</code> has been called, regardless of its return, |
| 118 | the <a class="link" href="txn.html" title="Chapter 12. The DB_TXN Handle">DB_TXN</a> handle may not |
| 119 | be accessed again. |
| 120 | </p> |
| 121 | <div class="sect2" lang="en" xml:lang="en"> |
| 122 | <div class="titlepage"> |
| 123 | <div> |
| 124 | <div> |
| 125 | <h3 class="title"><a id="idp54960048"></a>Parameters</h3> |
| 126 | </div> |
| 127 | </div> |
| 128 | </div> |
| 129 | <div class="sect3" lang="en" xml:lang="en"> |
| 130 | <div class="titlepage"> |
| 131 | <div> |
| 132 | <div> |
| 133 | <h4 class="title"><a id="idp54960240"></a>flags</h4> |
| 134 | </div> |
| 135 | </div> |
| 136 | </div> |
| 137 | <p> |
| 138 | The <span class="bold"><strong>flags</strong></span> parameter is currently |
| 139 | unused, and must be set to 0. |
| 140 | </p> |
| 141 | </div> |
| 142 | </div> |
| 143 | <div class="sect2" lang="en" xml:lang="en"> |
| 144 | <div class="titlepage"> |
| 145 | <div> |
| 146 | <div> |
| 147 | <h3 class="title"><a id="idp54922864"></a>Errors</h3> |
| 148 | </div> |
| 149 | </div> |
| 150 | </div> |
| 151 | <p> |
| 152 | The <code class="methodname">DB_TXN->discard()</code> <span> |
| 153 | <span> |
| 154 | method may fail and return one of the following non-zero errors: |
| 155 | </span> |
| 156 | |
| 157 | </span> |
| 158 | </p> |
| 159 | <div class="sect3" lang="en" xml:lang="en"> |
| 160 | <div class="titlepage"> |
| 161 | <div> |
| 162 | <div> |
| 163 | <h4 class="title"><a id="idp54958520"></a>EINVAL</h4> |
| 164 | </div> |
| 165 | </div> |
| 166 | </div> |
| 167 | <p> |
| 168 | If the transaction handle does not refer to a transaction that was |
| 169 | recovered into a prepared but not yet completed state; or if an |
| 170 | invalid flag value or parameter was specified. |
| 171 | </p> |
| 172 | </div> |
| 173 | </div> |
| 174 | <div class="sect2" lang="en" xml:lang="en"> |
| 175 | <div class="titlepage"> |
| 176 | <div> |
| 177 | <div> |
| 178 | <h3 class="title"><a id="idp54933696"></a>Class</h3> |
| 179 | </div> |
| 180 | </div> |
| 181 | </div> |
| 182 | <p> |
| 183 | <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> |
| 184 | </p> |
| 185 | </div> |
| 186 | <div class="sect2" lang="en" xml:lang="en"> |
| 187 | <div class="titlepage"> |
| 188 | <div> |
| 189 | <div> |
| 190 | <h3 class="title"><a id="idp54958968"></a>See Also</h3> |
| 191 | </div> |
| 192 | </div> |
| 193 | </div> |
| 194 | <p> |
| 195 | <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> |
| 196 | </p> |
| 197 | </div> |
| 198 | </div> |
| 199 | <div class="navfooter"> |
| 200 | <hr /> |
| 201 | <table width="100%" summary="Navigation footer"> |
| 202 | <tr> |
| 203 | <td width="40%" align="left"><a accesskey="p" href="txncommit.html">Prev</a> </td> |
| 204 | <td width="20%" align="center"> |
| 205 | <a accesskey="u" href="txn.html">Up</a> |
| 206 | </td> |
| 207 | <td width="40%" align="right"> <a accesskey="n" href="txnget_name.html">Next</a></td> |
| 208 | </tr> |
| 209 | <tr> |
| 210 | <td width="40%" align="left" valign="top">DB_TXN->commit() </td> |
| 211 | <td width="20%" align="center"> |
| 212 | <a accesskey="h" href="index.html">Home</a> |
| 213 | </td> |
| 214 | <td width="40%" align="right" valign="top"> DB_TXN->get_name()</td> |
| 215 | </tr> |
| 216 | </table> |
| 217 | </div> |
| 218 | </body> |
| 219 | </html> |