• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/db-4.8.30/docs/api_reference/C/
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>DB_ENV-&gt;dbremove()</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="env.html" title="Chapter��5.�� The DB_ENV Handle" />
11    <link rel="prev" href="envcreate.html" title="db_env_create" />
12    <link rel="next" href="envdbrename.html" title="DB_ENV-&gt;dbrename()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DB_ENV-&gt;dbremove()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="envcreate.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��5.��
23                The DB_ENV Handle
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="envdbrename.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="envdbremove"></a>DB_ENV-&gt;dbremove()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int
41DB_ENV-&gt;dbremove(DB_ENV *dbenv, DB_TXN *txnid,
42    const char *file, const char *database, u_int32_t flags);  </pre>
43      <p>
44         The <code class="methodname">DB_ENV-&gt;dbremove()</code> method removes the database specified by the
45         <span class="bold"><strong>file</strong></span> and <span class="bold"><strong>database</strong></span> parameters.  If no <span class="bold"><strong>database</strong></span> is specified, the underlying file
46         represented by <span class="bold"><strong>file</strong></span> is removed,
47         incidentally removing all of the databases it contained.
48    </p>
49      <p>
50         Applications should never remove databases with open 
51         <a class="link" href="db.html" title="Chapter��2.�� The DB Handle">DB</a>  handles, or in the case of
52         removing a file, when any database in the file has an open handle. 
53    </p>
54      <p>
55         The <code class="methodname">DB_ENV-&gt;dbremove()</code> <span>
56            <span>
57                  method returns a non-zero error value on failure and 0 on success.
58            </span>
59            
60        </span>
61    </p>
62      <p>
63        <code class="methodname">DB_ENV-&gt;dbremove()</code> is affected by any database directory specified using the
64        <a class="xref" href="envset_data_dir.html" title="DB_ENV-&gt;set_data_dir()">DB_ENV-&gt;set_data_dir()</a>
65        method, or by setting the <code class="literal">set_data_dir</code> string in the environment's
66        <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.
67    </p>
68      <div class="sect2" lang="en" xml:lang="en">
69        <div class="titlepage">
70          <div>
71            <div>
72              <h3 class="title"><a id="id1661258"></a>Parameters</h3>
73            </div>
74          </div>
75        </div>
76        <div class="sect3" lang="en" xml:lang="en">
77          <div class="titlepage">
78            <div>
79              <div>
80                <h4 class="title"><a id="id1661269"></a>database</h4>
81              </div>
82            </div>
83          </div>
84          <p>
85                          The <span class="bold"><strong>database</strong></span> parameter is the
86                          database to be removed.
87                     </p>
88        </div>
89        <div class="sect3" lang="en" xml:lang="en">
90          <div class="titlepage">
91            <div>
92              <div>
93                <h4 class="title"><a id="id1661301"></a>file</h4>
94              </div>
95            </div>
96          </div>
97          <p>
98                          The <span class="bold"><strong>file</strong></span> parameter is the physical
99                          file which contains the database(s) to be removed.
100                     </p>
101        </div>
102        <div class="sect3" lang="en" xml:lang="en">
103          <div class="titlepage">
104            <div>
105              <div>
106                <h4 class="title"><a id="id1661206"></a>txnid</h4>
107              </div>
108            </div>
109          </div>
110          <p>
111                          If the operation is part of an application-specified transaction, the
112                          <span class="bold"><strong>txnid</strong></span> parameter is a transaction
113                          handle returned from 
114                          <a class="xref" href="txnbegin.html" title="DB_ENV-&gt;txn_begin()">DB_ENV-&gt;txn_begin()</a>; if the
115                          operation is part of a Berkeley DB Concurrent Data Store group, the
116                          <span class="bold"><strong>txnid</strong></span> parameter is a handle returned
117                          from <a class="xref" href="envcdsgroup_begin.html" title="DB_ENV-&gt;cdsgroup_begin()">DB_ENV-&gt;cdsgroup_begin()</a>;
118                          otherwise NULL. If no transaction handle is specified, but the
119                          <code class="literal">DB_AUTO_COMMIT</code> flag is specified to either this method 
120                          or the environment handle, the operation will be implicitly transaction protected.
121                     </p>
122        </div>
123        <div class="sect3" lang="en" xml:lang="en">
124          <div class="titlepage">
125            <div>
126              <div>
127                <h4 class="title"><a id="id1661185"></a>flags</h4>
128              </div>
129            </div>
130          </div>
131          <p>
132                The <span class="bold"><strong>flags</strong></span> parameter must
133                be set to 0 or the following value:
134            </p>
135          <div class="itemizedlist">
136            <ul type="disc">
137              <li>
138                <p>
139                        <code class="literal">DB_AUTO_COMMIT</code>
140                    </p>
141                <p>
142                        Enclose the <code class="classname">DB_ENV-&gt;dbremove()</code>
143                        call within a transaction. If the call succeeds,
144                        changes made by the operation will be recoverable.
145                        If the call fails, the operation will have made no
146                        changes.
147                    </p>
148              </li>
149            </ul>
150          </div>
151        </div>
152      </div>
153      <div class="sect2" lang="en" xml:lang="en">
154        <div class="titlepage">
155          <div>
156            <div>
157              <h3 class="title"><a id="id1661468"></a>Environment Variables</h3>
158            </div>
159          </div>
160        </div>
161        <p>
162                         The  environment variable <code class="literal">DB_HOME</code> may be used as the path of
163                         the database environment home.
164                    </p>
165      </div>
166      <div class="sect2" lang="en" xml:lang="en">
167        <div class="titlepage">
168          <div>
169            <div>
170              <h3 class="title"><a id="id1661454"></a>Errors</h3>
171            </div>
172          </div>
173        </div>
174        <p>
175                         The <code class="methodname">DB_ENV-&gt;dbremove()</code> <span>
176            <span>
177                 method may fail and return one of the following non-zero errors:
178            </span>
179            
180        </span>
181                    </p>
182        <div class="sect3" lang="en" xml:lang="en">
183          <div class="titlepage">
184            <div>
185              <div>
186                <h4 class="title"><a id="id1661337"></a>DB_LOCK_DEADLOCK</h4>
187              </div>
188            </div>
189          </div>
190          <p>
191                A transactional database environment operation was selected to resolve
192                a deadlock.
193            </p>
194        </div>
195        <div class="sect3" lang="en" xml:lang="en">
196          <div class="titlepage">
197            <div>
198              <div>
199                <h4 class="title"><a id="id1661530"></a>DB_LOCK_NOTGRANTED</h4>
200              </div>
201            </div>
202          </div>
203          <p>
204                A Berkeley DB Concurrent Data Store database environment configured
205                for lock timeouts was unable to grant a lock in the allowed time.
206            </p>
207        </div>
208        <div class="sect3" lang="en" xml:lang="en">
209          <div class="titlepage">
210            <div>
211              <div>
212                <h4 class="title"><a id="id1661204"></a>EINVAL</h4>
213              </div>
214            </div>
215          </div>
216          <p>
217                If the method was called before <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> 
218                was called; or if an invalid flag value or parameter was specified.
219            </p>
220        </div>
221        <div class="sect3" lang="en" xml:lang="en">
222          <div class="titlepage">
223            <div>
224              <div>
225                <h4 class="title"><a id="id1661519"></a>ENOENT</h4>
226              </div>
227            </div>
228          </div>
229          <p>
230                The file or directory does not exist.
231            </p>
232        </div>
233      </div>
234      <div class="sect2" lang="en" xml:lang="en">
235        <div class="titlepage">
236          <div>
237            <div>
238              <h3 class="title"><a id="id1661535"></a>Class</h3>
239            </div>
240          </div>
241        </div>
242        <p>
243                <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>  
244            </p>
245      </div>
246      <div class="sect2" lang="en" xml:lang="en">
247        <div class="titlepage">
248          <div>
249            <div>
250              <h3 class="title"><a id="id1661672"></a>See Also</h3>
251            </div>
252          </div>
253        </div>
254        <p>
255                     <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 
256                </p>
257      </div>
258    </div>
259    <div class="navfooter">
260      <hr />
261      <table width="100%" summary="Navigation footer">
262        <tr>
263          <td width="40%" align="left"><a accesskey="p" href="envcreate.html">Prev</a>��</td>
264          <td width="20%" align="center">
265            <a accesskey="u" href="env.html">Up</a>
266          </td>
267          <td width="40%" align="right">��<a accesskey="n" href="envdbrename.html">Next</a></td>
268        </tr>
269        <tr>
270          <td width="40%" align="left" valign="top">db_env_create��</td>
271          <td width="20%" align="center">
272            <a accesskey="h" href="index.html">Home</a>
273          </td>
274          <td width="40%" align="right" valign="top">��DB_ENV-&gt;dbrename()</td>
275        </tr>
276      </table>
277    </div>
278  </body>
279</html>
280