Debian Codegraph @

docs/api_reference/CXX/dbcdel.html

raw symbols SCIP
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::del()</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="dbccount.html" title="Dbc::count()" />
12 <link rel="next" href="dbcdup.html" title="Dbc::dup()" />
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">Dbc::del()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="dbccount.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 3. 
26 The Dbc Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="dbcdup.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="dbcdel"></a>Dbc::del()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 Dbc::del(u_int32_t flags);</pre>
45 <p>
46 The <code class="methodname">Dbc::del()</code> method deletes the key/data pair to which the
47 cursor refers.
48 </p>
49 <p>
50 When called on a cursor opened on a database that has been made into a
51 secondary index using the
52 <a class="xref" href="dbassociate.html" title="Db::associate()">Db::associate()</a> method, the
53 <a class="xref" href="dbdel.html" title="Db::del()">Db::del()</a> method deletes
54 the key/data pair from the primary database and all secondary indices.
55 </p>
56 <p>
57 The cursor position is unchanged after a delete, and subsequent calls
58 to cursor functions expecting the cursor to refer to an existing key
59 will fail.
60 </p>
61 <p>
62 The <code class="methodname">Dbc::del()</code> method will return <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_KEYEMPTY" class="olink">DB_KEYEMPTY</a> if
63 the element has already been deleted. The <code class="methodname">Dbc::del()</code>
64 <span>
65
66 <span>
67 method either returns a non-zero error value or throws an
68 exception that encapsulates a non-zero error value on
69 failure, and returns 0 on success.
70 </span>
71 </span>
72 </p>
73 <div class="sect2" lang="en" xml:lang="en">
74 <div class="titlepage">
75 <div>
76 <div>
77 <h3 class="title"><a id="idp6126480"></a>Parameters</h3>
78 </div>
79 </div>
80 </div>
81 <div class="sect3" lang="en" xml:lang="en">
82 <div class="titlepage">
83 <div>
84 <div>
85 <h4 class="title"><a id="idp6125296"></a>flags</h4>
86 </div>
87 </div>
88 </div>
89 <p>
90 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
91 or one of the following values:
92 </p>
93 <div class="itemizedlist">
94 <ul type="disc">
95 <li>
96 <p><a id="dbcput_DB_CONSUME"></a>
97 <code class="literal">DB_CONSUME</code>
98 </p>
99 <p>
100 If the database is of type DB_QUEUE then this flag may be set to force the head of the queue
101 to move to the first non-deleted item in the queue. Normally this is only done if the
102 deleted item is exactly at the head when deleted.
103 </p>
104 </li>
105 </ul>
106 </div>
107 </div>
108 </div>
109 <div class="sect2" lang="en" xml:lang="en">
110 <div class="titlepage">
111 <div>
112 <div>
113 <h3 class="title"><a id="idp6161976"></a>Errors</h3>
114 </div>
115 </div>
116 </div>
117 <p>
118 The <code class="methodname">Dbc::del()</code> <span>
119
120 <span>
121 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
122 exception, encapsulating one of the following non-zero errors, or return one
123 of the following non-zero errors:
124 </span>
125 </span>
126 </p>
127 <div class="sect3" lang="en" xml:lang="en">
128 <div class="titlepage">
129 <div>
130 <div>
131 <h4 class="title"><a id="idp6170152"></a>DB_FOREIGN_CONFLICT</h4>
132 </div>
133 </div>
134 </div>
135 <p>
136 A <a class="link" href="dbassociate_foreign.html" title="Db::associate_foreign()">foreign key constraint violation</a>
137 has occurred. This can be caused by one of two things:
138 </p>
139 <div class="orderedlist">
140 <ol type="1">
141 <li>
142 <p>
143 An attempt was made to add a record to a
144 constrained database, and the key used for that
145 record does not exist in the foreign key
146 database.
147 </p>
148 </li>
149 <li>
150 <p>
151 <a class="link" href="dbassociate_foreign.html#associate_foreign_DB_FOREIGN_ABORT">DB_FOREIGN_ABORT</a>
152 was declared for a foreign key database, and then
153 subsequently a record was deleted from the
154 foreign key database without first removing it
155 from the constrained secondary database.
156 </p>
157 </li>
158 </ol>
159 </div>
160 </div>
161 <div class="sect3" lang="en" xml:lang="en">
162 <div class="titlepage">
163 <div>
164 <div>
165 <h4 class="title"><a id="idp6145528"></a><span>DbDeadlockException or </span>DB_LOCK_DEADLOCK</h4>
166 </div>
167 </div>
168 </div>
169 <p>
170 A transactional database environment operation was selected to resolve
171 a deadlock.
172 </p>
173 <p>
174 <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if
175 your Berkeley DB API is configured to throw exceptions.
176 Otherwise, <code class="literal">DB_LOCK_DEADLOCK</code> is returned.
177 </p>
178 </div>
179 <div class="sect3" lang="en" xml:lang="en">
180 <div class="titlepage">
181 <div>
182 <div>
183 <h4 class="title"><a id="idp6162944"></a><span>DbLockNotGrantedException or </span>DB_LOCK_NOTGRANTED</h4>
184 </div>
185 </div>
186 </div>
187 <p>
188 A Berkeley DB Concurrent Data Store database environment configured
189 for lock timeouts was unable to grant a lock in the allowed time.
190 </p>
191 <p>
192 You attempted to open a database handle that is configured
193 for no waiting exclusive locking, but the exclusive lock could not be
194 immediately obtained. See
195 <a class="xref" href="dbset_lk_exclusive.html" title="Db::set_lk_exclusive()">Db::set_lk_exclusive()</a>
196 for more information.
197 </p>
198 <p>
199 <a class="xref" href="dblocknotgranted.html" title="DbLockNotGrantedException">DbLockNotGrantedException</a> is thrown if
200 your Berkeley DB API is configured to throw exceptions.
201 Otherwise, <code class="literal">DB_LOCK_NOTGRANTED</code> is returned.
202 </p>
203 </div>
204 <div class="sect3" lang="en" xml:lang="en">
205 <div class="titlepage">
206 <div>
207 <div>
208 <h4 class="title"><a id="idp6163176"></a> <span>DbRepHandleDeadException or</span> DB_REP_HANDLE_DEAD</h4>
209 </div>
210 </div>
211 </div>
212 <p>
213 When a client synchronizes with the master, it is possible for committed
214 transactions to be rolled back. This invalidates all the database and cursor
215 handles opened in the replication environment. Once this occurs, an attempt to use
216 such a handle will
217 <span>
218 throw a <a class="xref" href="dbrephandledead.html" title="DbRepHandleDeadException">DbRepHandleDeadException</a> (if
219 your application is configured to throw exceptions), or
220 </span>
221 return <code class="literal">DB_REP_HANDLE_DEAD</code>.
222 The application will need to discard the handle and open a new one in order to
223 continue processing.
224 </p>
225 </div>
226 <div class="sect3" lang="en" xml:lang="en">
227 <div class="titlepage">
228 <div>
229 <div>
230 <h4 class="title"><a id="idp6174240"></a><span>DbDeadlockException or </span>DB_REP_LOCKOUT</h4>
231 </div>
232 </div>
233 </div>
234 <p>
235 The operation was blocked by client/master synchronization.
236 </p>
237 <p>
238 <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if
239 your Berkeley DB API is configured to throw exceptions.
240 Otherwise, <code class="literal">DB_REP_LOCKOUT</code> is returned.
241 </p>
242 </div>
243 <div class="sect3" lang="en" xml:lang="en">
244 <div class="titlepage">
245 <div>
246 <div>
247 <h4 class="title"><a id="idp6175320"></a>DB_SECONDARY_BAD</h4>
248 </div>
249 </div>
250 </div>
251 <p>
252 A secondary index references a nonexistent primary key.
253 </p>
254 </div>
255 <div class="sect3" lang="en" xml:lang="en">
256 <div class="titlepage">
257 <div>
258 <div>
259 <h4 class="title"><a id="idp6155448"></a>EACCES</h4>
260 </div>
261 </div>
262 </div>
263 <p>
264 An attempt was made to modify a read-only database.
265 </p>
266 </div>
267 <div class="sect3" lang="en" xml:lang="en">
268 <div class="titlepage">
269 <div>
270 <div>
271 <h4 class="title"><a id="idp6155856"></a>EINVAL</h4>
272 </div>
273 </div>
274 </div>
275 <p>
276 If the cursor has not been initialized; or if an invalid flag value or parameter was specified.
277 </p>
278 </div>
279 <div class="sect3" lang="en" xml:lang="en">
280 <div class="titlepage">
281 <div>
282 <div>
283 <h4 class="title"><a id="idp6156312"></a>EPERM</h4>
284 </div>
285 </div>
286 </div>
287 <p>
288 Write attempted on read-only cursor when the
289 <a class="link" href="envopen.html#envopen_DB_INIT_CDB">DB_INIT_CDB</a>
290 flag was specified to <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>.
291 </p>
292 </div>
293 </div>
294 <div class="sect2" lang="en" xml:lang="en">
295 <div class="titlepage">
296 <div>
297 <div>
298 <h3 class="title"><a id="idp6161760"></a>Class</h3>
299 </div>
300 </div>
301 </div>
302 <p>
303 <a class="link" href="dbc.html" title="Chapter 3.  The Dbc Handle">Dbc</a>
304 </p>
305 </div>
306 <div class="sect2" lang="en" xml:lang="en">
307 <div class="titlepage">
308 <div>
309 <div>
310 <h3 class="title"><a id="idp6159632"></a>See Also</h3>
311 </div>
312 </div>
313 </div>
314 <p>
315 <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a>
316 </p>
317 </div>
318 </div>
319 <div class="navfooter">
320 <hr />
321 <table width="100%" summary="Navigation footer">
322 <tr>
323 <td width="40%" align="left"><a accesskey="p" href="dbccount.html">Prev</a> </td>
324 <td width="20%" align="center">
325 <a accesskey="u" href="dbc.html">Up</a>
326 </td>
327 <td width="40%" align="right"> <a accesskey="n" href="dbcdup.html">Next</a></td>
328 </tr>
329 <tr>
330 <td width="40%" align="left" valign="top">Dbc::count() </td>
331 <td width="20%" align="center">
332 <a accesskey="h" href="index.html">Home</a>
333 </td>
334 <td width="40%" align="right" valign="top"> Dbc::dup()</td>
335 </tr>
336 </table>
337 </div>
338 </body>
339 </html>