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>Dbc::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 Dbc Handle" /> 11 <link rel="prev" href="dbcursor.html" title="Db::cursor()" /> 12 <link rel="next" href="dbccmp.html" title="Dbc::cmp()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Dbc::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 Dbc 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>Dbc::close()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41Dbc::close(void);</pre> 42 <p> 43 The <code class="methodname">Dbc::close()</code> method discards the cursor. 44 </p> 45 <p> 46 It is possible for the <code class="methodname">Dbc::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">Dbc::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">Dbc::close()</code> <span> 57 58 <span> 59 method either returns a non-zero error value or throws an 60 exception that encapsulates a non-zero error value on 61 failure, and returns 0 on success. 62 </span> 63 </span> 64 </p> 65 <div class="sect2" lang="en" xml:lang="en"> 66 <div class="titlepage"> 67 <div> 68 <div> 69 <h3 class="title"><a id="id1654601"></a>Errors</h3> 70 </div> 71 </div> 72 </div> 73 <p> 74 The <code class="methodname">Dbc::close()</code> <span> 75 76 <span> 77 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 78 exception, encapsulating one of the following non-zero errors, or return one 79 of the following non-zero errors: 80 </span> 81 </span> 82 </p> 83 <div class="sect3" lang="en" xml:lang="en"> 84 <div class="titlepage"> 85 <div> 86 <div> 87 <h4 class="title"><a id="id1654789"></a><span>DbDeadlockException or </span>DB_LOCK_DEADLOCK</h4> 88 </div> 89 </div> 90 </div> 91 <p> 92 A transactional database environment operation was selected to resolve 93 a deadlock. 94 </p> 95 <p> 96 <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if 97 your Berkeley DB API is configured to throw exceptions. 98 Otherwise, <code class="literal">DB_LOCK_DEADLOCK</code> is returned. 99 </p> 100 </div> 101 <div class="sect3" lang="en" xml:lang="en"> 102 <div class="titlepage"> 103 <div> 104 <div> 105 <h4 class="title"><a id="id1655022"></a><span>DbLockNotGrantedException or </span>DB_LOCK_NOTGRANTED</h4> 106 </div> 107 </div> 108 </div> 109 <p> 110 A Berkeley DB Concurrent Data Store database environment configured 111 for lock timeouts was unable to grant a lock in the allowed time. 112 </p> 113 <p> 114 <a class="xref" href="dblocknotgranted.html" title="DbLockNotGrantedException">DbLockNotGrantedException</a> is thrown if 115 your Berkeley DB API is configured to throw exceptions. 116 Otherwise, <code class="literal">DB_LOCK_NOTGRANTED</code> is returned. 117 </p> 118 </div> 119 <div class="sect3" lang="en" xml:lang="en"> 120 <div class="titlepage"> 121 <div> 122 <div> 123 <h4 class="title"><a id="id1654979"></a>EINVAL</h4> 124 </div> 125 </div> 126 </div> 127 <p> 128 If the cursor is already closed; or if an invalid flag value or parameter was specified. 129 </p> 130 </div> 131 </div> 132 <div class="sect2" lang="en" xml:lang="en"> 133 <div class="titlepage"> 134 <div> 135 <div> 136 <h3 class="title"><a id="id1654812"></a>Class</h3> 137 </div> 138 </div> 139 </div> 140 <p> 141 <a class="link" href="dbc.html" title="Chapter 3. The Dbc Handle">Dbc</a> 142 </p> 143 </div> 144 <div class="sect2" lang="en" xml:lang="en"> 145 <div class="titlepage"> 146 <div> 147 <div> 148 <h3 class="title"><a id="id1655115"></a>See Also</h3> 149 </div> 150 </div> 151 </div> 152 <p> 153 <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a> 154 </p> 155 </div> 156 </div> 157 <div class="navfooter"> 158 <hr /> 159 <table width="100%" summary="Navigation footer"> 160 <tr> 161 <td width="40%" align="left"><a accesskey="p" href="dbcursor.html">Prev</a> </td> 162 <td width="20%" align="center"> 163 <a accesskey="u" href="dbc.html">Up</a> 164 </td> 165 <td width="40%" align="right"> <a accesskey="n" href="dbccmp.html">Next</a></td> 166 </tr> 167 <tr> 168 <td width="40%" align="left" valign="top">Db::cursor() </td> 169 <td width="20%" align="center"> 170 <a accesskey="h" href="index.html">Home</a> 171 </td> 172 <td width="40%" align="right" valign="top"> Dbc::cmp()</td> 173 </tr> 174 </table> 175 </div> 176 </body> 177</html> 178