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 class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DBcursor->close()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbcursor.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 3. 23 The DBcursor Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="dbccmp.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="dbcclose"></a>DBcursor->close()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DBcursor->close(DBC *DBcursor); </pre> 42 <p> 43 The <code class="methodname">DBcursor->close()</code> method discards the cursor. 44 </p> 45 <p> 46 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>, 47 signaling that any enclosing transaction should be aborted. If the 48 application is already intending to abort the transaction, this error 49 should be ignored, and the application should proceed. 50 </p> 51 <p> 52 After <code class="methodname">DBcursor->close()</code> has been called, regardless of its return, 53 the cursor handle may not be used again. 54 </p> 55 <p> 56 The <code class="methodname">DBcursor->close()</code> <span> 57 <span> 58 method returns a non-zero error value on failure and 0 on success. 59 </span> 60 61 </span> 62 </p> 63 <div class="sect2" lang="en" xml:lang="en"> 64 <div class="titlepage"> 65 <div> 66 <div> 67 <h3 class="title"><a id="id1653472"></a>Errors</h3> 68 </div> 69 </div> 70 </div> 71 <p> 72 The <code class="methodname">DBcursor->close()</code> <span> 73 <span> 74 method may fail and return one of the following non-zero errors: 75 </span> 76 77 </span> 78 </p> 79 <div class="sect3" lang="en" xml:lang="en"> 80 <div class="titlepage"> 81 <div> 82 <div> 83 <h4 class="title"><a id="id1653326"></a>DB_LOCK_DEADLOCK</h4> 84 </div> 85 </div> 86 </div> 87 <p> 88 A transactional database environment operation was selected to resolve 89 a deadlock. 90 </p> 91 </div> 92 <div class="sect3" lang="en" xml:lang="en"> 93 <div class="titlepage"> 94 <div> 95 <div> 96 <h4 class="title"><a id="id1653800"></a>DB_LOCK_NOTGRANTED</h4> 97 </div> 98 </div> 99 </div> 100 <p> 101 A Berkeley DB Concurrent Data Store database environment configured 102 for lock timeouts was unable to grant a lock in the allowed time. 103 </p> 104 </div> 105 <div class="sect3" lang="en" xml:lang="en"> 106 <div class="titlepage"> 107 <div> 108 <div> 109 <h4 class="title"><a id="id1653773"></a>EINVAL</h4> 110 </div> 111 </div> 112 </div> 113 <p> 114 If the cursor is already closed; or if an invalid flag value or parameter was specified. 115 </p> 116 </div> 117 </div> 118 <div class="sect2" lang="en" xml:lang="en"> 119 <div class="titlepage"> 120 <div> 121 <div> 122 <h3 class="title"><a id="id1653774"></a>Class</h3> 123 </div> 124 </div> 125 </div> 126 <p> 127 <a class="link" href="dbc.html" title="Chapter 3. The DBcursor Handle">DBcursor</a> 128 </p> 129 </div> 130 <div class="sect2" lang="en" xml:lang="en"> 131 <div class="titlepage"> 132 <div> 133 <div> 134 <h3 class="title"><a id="id1653325"></a>See Also</h3> 135 </div> 136 </div> 137 </div> 138 <p> 139 <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a> 140 </p> 141 </div> 142 </div> 143 <div class="navfooter"> 144 <hr /> 145 <table width="100%" summary="Navigation footer"> 146 <tr> 147 <td width="40%" align="left"><a accesskey="p" href="dbcursor.html">Prev</a> </td> 148 <td width="20%" align="center"> 149 <a accesskey="u" href="dbc.html">Up</a> 150 </td> 151 <td width="40%" align="right"> <a accesskey="n" href="dbccmp.html">Next</a></td> 152 </tr> 153 <tr> 154 <td width="40%" align="left" valign="top">DB->cursor() </td> 155 <td width="20%" align="center"> 156 <a accesskey="h" href="index.html">Home</a> 157 </td> 158 <td width="40%" align="right" valign="top"> DBcursor->cmp()</td> 159 </tr> 160 </table> 161 </div> 162 </body> 163</html> 164