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: Dbc::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>Dbc::del</b>
14</td>
15<td align=right>
16<a href="/api_cxx/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_cxx.h&gt;
23<p>
24int
25Dbc::del(u_int32_t flags);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: Dbc::del</b>
29<p>The Dbc::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_cxx/db_associate.html">Db::associate</a> method, the <a href="/api_cxx/db_del.html">Db::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 Dbc::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 Dbc::del method
40either returns a non-zero error value
41or throws an exception that encapsulates a non-zero error value on
42failure, and returns 0 on success.
43</p>
44<b>Parameters</b> <br>
45 <b>flags</b><ul compact><li>The <b>flags</b> parameter is currently unused, and must be set to 0.</ul>
46<br>
47<br><b>Errors</b>
48<p>The Dbc::del method
49may fail and throw
50<a href="/api_cxx/except_class.html">DbException</a>,
51encapsulating one of the following non-zero errors, or return one of
52the following non-zero errors:</p>
53<br>
54<b>DB_REP_HANDLE_DEAD</b><ul compact><li>The database handle has been invalidated because a replication election
55unrolled a committed transaction.</ul>
56<br>
57<br>
58<b>DB_REP_LOCKOUT</b><ul compact><li>The operation was blocked by client/master synchronization.</ul>
59<br>
60<br>
61<b>DB_SECONDARY_BAD</b><ul compact><li>A secondary index references a nonexistent primary key.</ul>
62<br>
63<br>
64<b>EACCES</b><ul compact><li>An attempt was made to modify a read-only database.</ul>
65<br>
66<br>
67<b>EINVAL</b><ul compact><li>If the cursor has not been initialized; or if an
68invalid flag value or parameter was specified.</ul>
69<br>
70<br>
71<b>EPERM  </b><ul compact><li>Write attempted on read-only cursor when the <a href="/api_cxx/env_open.html#DB_INIT_CDB">DB_INIT_CDB</a> flag was
72specified to <a href="/api_cxx/env_open.html">DbEnv::open</a>.</ul>
73<br>
74<p>If a transactional database environment operation was selected to
75resolve a deadlock, the Dbc::del method will fail and
76either return <a href="/ref/program/errorret.html#DB_LOCK_DEADLOCK">DB_LOCK_DEADLOCK</a> or
77throw a <a href="/api_cxx/deadlock_class.html">DbDeadlockException</a> exception.</p>
78<p>If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable
79to grant a lock in the allowed time, the Dbc::del method will fail and
80either return <a href="/ref/program/errorret.html#DB_LOCK_NOTGRANTED">DB_LOCK_NOTGRANTED</a> or
81throw a <a href="/api_cxx/lockng_class.html">DbLockNotGrantedException</a> exception.</p>
82<hr size=1 noshade>
83<br><b>Class</b>
84<a href="/api_cxx/dbc_class.html">Dbc</a>
85<br><b>See Also</b>
86<a href="/api_cxx/dbc_list.html">Database Cursors and Related Methods</a>
87</tt>
88<table width="100%"><tr><td><br></td><td align=right>
89<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
90</td></tr></table>
91<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
92</body>
93</html>
94