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