1<!--$Id: dbc_del.so,v 10.49 2007/10/24 16:06:07 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DBcursor-&gt;del</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DBcursor-&gt;del</b>
14</td>
15<td align=right>
16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DBcursor-&gt;del(DBC *DBcursor, u_int32_t flags);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DBcursor-&gt;del</b>
29<p>The DBcursor-&gt;del method deletes the key/data pair to which the cursor
30refers.</p>
31<p>When called on a cursor opened on a database that has been made into a
32secondary index using the <a href="../api_c/db_associate.html">DB-&gt;associate</a> method, the <a href="../api_c/db_del.html">DB-&gt;del</a> method
33deletes the key/data pair from the primary database and all secondary
34indices.</p>
35<p>The cursor position is unchanged after a delete, and subsequent calls to
36cursor functions expecting the cursor to refer to an existing key will
37fail.</p>
38<p>The DBcursor-&gt;del method will return <a href="../ref/program/errorret.html#DB_KEYEMPTY">DB_KEYEMPTY</a> if the element has already been deleted.
39Unless otherwise specified, the DBcursor-&gt;del method
40returns a non-zero error value on failure
41and 0 on success.
42</p>
43<b>Parameters</b> <br>
44 <b>flags</b><ul compact><li>The <b>flags</b> parameter is currently unused, and must be set to 0.</ul>
45<br>
46<br><b>Errors</b>
47<p>The DBcursor-&gt;del method
48may fail and return one of the following non-zero errors:</p>
49<br>
50<b>DB_LOCK_DEADLOCK</b><ul compact><li>A transactional database environment operation was selected to resolve
51a deadlock.</ul>
52<b>DB_LOCK_NOTGRANTED</b><ul compact><li>A Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable
53to grant a lock in the allowed time.</ul>
54<br>
55<br>
56<b>DB_REP_HANDLE_DEAD</b><ul compact><li>The database handle has been invalidated because a replication election
57unrolled a committed transaction.</ul>
58<br>
59<br>
60<b>DB_REP_LOCKOUT</b><ul compact><li>The operation was blocked by client/master synchronization.</ul>
61<br>
62<br>
63<b>DB_SECONDARY_BAD</b><ul compact><li>A secondary index references a nonexistent primary key.</ul>
64<br>
65<br>
66<b>EACCES</b><ul compact><li>An attempt was made to modify a read-only database.</ul>
67<br>
68<br>
69<b>EINVAL</b><ul compact><li>If the cursor has not been initialized; or if an
70invalid flag value or parameter was specified.</ul>
71<br>
72<br>
73<b>EPERM  </b><ul compact><li>Write attempted on read-only cursor when the <a href="../api_c/env_open.html#DB_INIT_CDB">DB_INIT_CDB</a> flag was
74specified to <a href="../api_c/env_open.html">DB_ENV-&gt;open</a>.</ul>
75<br>
76<hr size=1 noshade>
77<br><b>Class</b>
78<a href="../api_c/dbc_class.html">DBC</a>
79<br><b>See Also</b>
80<a href="../api_c/dbc_list.html">Database Cursors and Related Methods</a>
81</tt>
82<table width="100%"><tr><td><br></td><td align=right>
83<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
84</td></tr></table>
85<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
86</body>
87</html>
88