| 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>DBcursor->close()</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="dbc.html" title="Chapter 3. The DBcursor Handle" /> |
| 11 | <link rel="prev" href="dbcursor.html" title="DB->cursor()" /> |
| 12 | <link rel="next" href="dbccmp.html" title="DBcursor->cmp()" /> |
| 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">DBcursor->close()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="dbcursor.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 3. |
| 26 | The DBcursor Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="dbccmp.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="dbcclose"></a>DBcursor->close()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DBcursor->close(DBC *DBcursor); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DBcursor->close()</code> method discards the cursor. |
| 47 | </p> |
| 48 | <p> |
| 49 | It is possible for the <code class="methodname">DBcursor->close()</code> method to return <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_LOCK_DEADLOCK" class="olink">DB_LOCK_DEADLOCK</a>, |
| 50 | signaling that any enclosing transaction should be aborted. If the |
| 51 | application is already intending to abort the transaction, this error |
| 52 | should be ignored, and the application should proceed. |
| 53 | </p> |
| 54 | <p> |
| 55 | After the <code class="methodname">DBcursor->close()</code> method has been called, regardless of its return value, |
| 56 | you can not use the cursor handle again. |
| 57 | </p> |
| 58 | <p> |
| 59 | It is not required to close the cursor explicitly before closing the database handle or the transaction handle that owns this cursor |
| 60 | because, closing a database handle or a transaction handle closes those open cursors. |
| 61 | |
| 62 | </p> |
| 63 | <p> |
| 64 | However, it is recommended that you always close all cursor handles immediately after |
| 65 | their use to promote concurrency and to release resources such as page locks. |
| 66 | </p> |
| 67 | <p> |
| 68 | The <code class="methodname">DBcursor->close()</code> <span> |
| 69 | <span> |
| 70 | method returns a non-zero error value on failure and 0 on success. |
| 71 | </span> |
| 72 | |
| 73 | </span> |
| 74 | </p> |
| 75 | <div class="sect2" lang="en" xml:lang="en"> |
| 76 | <div class="titlepage"> |
| 77 | <div> |
| 78 | <div> |
| 79 | <h3 class="title"><a id="idp50799592"></a>Errors</h3> |
| 80 | </div> |
| 81 | </div> |
| 82 | </div> |
| 83 | <p> |
| 84 | The <code class="methodname">DBcursor->close()</code> <span> |
| 85 | <span> |
| 86 | method may fail and return one of the following non-zero errors: |
| 87 | </span> |
| 88 | |
| 89 | </span> |
| 90 | </p> |
| 91 | <div class="sect3" lang="en" xml:lang="en"> |
| 92 | <div class="titlepage"> |
| 93 | <div> |
| 94 | <div> |
| 95 | <h4 class="title"><a id="idp50806120"></a>DB_LOCK_DEADLOCK</h4> |
| 96 | </div> |
| 97 | </div> |
| 98 | </div> |
| 99 | <p> |
| 100 | A transactional database environment operation was selected to resolve |
| 101 | a deadlock. |
| 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="idp50833936"></a>DB_LOCK_NOTGRANTED</h4> |
| 109 | </div> |
| 110 | </div> |
| 111 | </div> |
| 112 | <p> |
| 113 | A Berkeley DB Concurrent Data Store database environment configured |
| 114 | for lock timeouts was unable to grant a lock in the allowed time. |
| 115 | </p> |
| 116 | <p> |
| 117 | You attempted to open a database handle that is configured |
| 118 | for no waiting exclusive locking, but the exclusive lock could not be |
| 119 | immediately obtained. See |
| 120 | <a class="xref" href="dbset_lk_exclusive.html" title="DB->set_lk_exclusive()">DB->set_lk_exclusive()</a> |
| 121 | for more information. |
| 122 | </p> |
| 123 | </div> |
| 124 | <div class="sect3" lang="en" xml:lang="en"> |
| 125 | <div class="titlepage"> |
| 126 | <div> |
| 127 | <div> |
| 128 | <h4 class="title"><a id="idp50801024"></a>EINVAL</h4> |
| 129 | </div> |
| 130 | </div> |
| 131 | </div> |
| 132 | <p> |
| 133 | If the cursor is already closed; or if an invalid flag value or parameter was specified. |
| 134 | </p> |
| 135 | </div> |
| 136 | </div> |
| 137 | <div class="sect2" lang="en" xml:lang="en"> |
| 138 | <div class="titlepage"> |
| 139 | <div> |
| 140 | <div> |
| 141 | <h3 class="title"><a id="idp50801264"></a>Class</h3> |
| 142 | </div> |
| 143 | </div> |
| 144 | </div> |
| 145 | <p> |
| 146 | <a class="link" href="dbc.html" title="Chapter 3. The DBcursor Handle">DBcursor</a> |
| 147 | </p> |
| 148 | </div> |
| 149 | <div class="sect2" lang="en" xml:lang="en"> |
| 150 | <div class="titlepage"> |
| 151 | <div> |
| 152 | <div> |
| 153 | <h3 class="title"><a id="idp50817072"></a>See Also</h3> |
| 154 | </div> |
| 155 | </div> |
| 156 | </div> |
| 157 | <p> |
| 158 | <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a> |
| 159 | </p> |
| 160 | </div> |
| 161 | </div> |
| 162 | <div class="navfooter"> |
| 163 | <hr /> |
| 164 | <table width="100%" summary="Navigation footer"> |
| 165 | <tr> |
| 166 | <td width="40%" align="left"><a accesskey="p" href="dbcursor.html">Prev</a> </td> |
| 167 | <td width="20%" align="center"> |
| 168 | <a accesskey="u" href="dbc.html">Up</a> |
| 169 | </td> |
| 170 | <td width="40%" align="right"> <a accesskey="n" href="dbccmp.html">Next</a></td> |
| 171 | </tr> |
| 172 | <tr> |
| 173 | <td width="40%" align="left" valign="top">DB->cursor() </td> |
| 174 | <td width="20%" align="center"> |
| 175 | <a accesskey="h" href="index.html">Home</a> |
| 176 | </td> |
| 177 | <td width="40%" align="right" valign="top"> DBcursor->cmp()</td> |
| 178 | </tr> |
| 179 | </table> |
| 180 | </div> |
| 181 | </body> |
| 182 | </html> |