• 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>DbEnv::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 DbEnv Handle" />
11    <link rel="prev" href="envcreate.html" title="DbEnv" />
12    <link rel="next" href="envdbrename.html" title="DbEnv::dbrename()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DbEnv::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 DbEnv 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>DbEnv::dbremove()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41DbEnv::dbremove(DbTxn *txnid,
42    const char *file, const char *database, u_int32_t flags);</pre>
43      <p>
44         The <code class="methodname">DbEnv::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">DbEnv::dbremove()</code> <span>
56            
57            <span>
58                method either returns a non-zero error value or throws an
59                exception that encapsulates a non-zero error value on
60                failure, and returns 0 on success.
61            </span>
62        </span>
63    </p>
64      <p>
65        <code class="methodname">DbEnv::dbremove()</code> is affected by any database directory specified using the
66        <a class="xref" href="envset_data_dir.html" title="DbEnv::set_data_dir()">DbEnv::set_data_dir()</a>
67        method, or by setting the <code class="literal">set_data_dir</code> string in the environment's
68        <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.
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="id1663248"></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="id1663259"></a>database</h4>
83              </div>
84            </div>
85          </div>
86          <p>
87                          The <span class="bold"><strong>database</strong></span> parameter is the
88                          database to be removed.
89                     </p>
90        </div>
91        <div class="sect3" lang="en" xml:lang="en">
92          <div class="titlepage">
93            <div>
94              <div>
95                <h4 class="title"><a id="id1663497"></a>file</h4>
96              </div>
97            </div>
98          </div>
99          <p>
100                          The <span class="bold"><strong>file</strong></span> parameter is the physical
101                          file which contains the database(s) to be removed.
102                     </p>
103        </div>
104        <div class="sect3" lang="en" xml:lang="en">
105          <div class="titlepage">
106            <div>
107              <div>
108                <h4 class="title"><a id="id1663483"></a>txnid</h4>
109              </div>
110            </div>
111          </div>
112          <p>
113                          If the operation is part of an application-specified transaction, the
114                          <span class="bold"><strong>txnid</strong></span> parameter is a transaction
115                          handle returned from 
116                          <a class="xref" href="txnbegin.html" title="DbEnv::txn_begin()">DbEnv::txn_begin()</a>; if the
117                          operation is part of a Berkeley DB Concurrent Data Store group, the
118                          <span class="bold"><strong>txnid</strong></span> parameter is a handle returned
119                          from <a class="xref" href="envcdsgroup_begin.html" title="DbEnv::cdsgroup_begin()">DbEnv::cdsgroup_begin()</a>;
120                          otherwise NULL. If no transaction handle is specified, but the
121                          <code class="literal">DB_AUTO_COMMIT</code> flag is specified to either this method 
122                          or the environment handle, the operation will be implicitly transaction protected.
123                     </p>
124        </div>
125        <div class="sect3" lang="en" xml:lang="en">
126          <div class="titlepage">
127            <div>
128              <div>
129                <h4 class="title"><a id="id1663412"></a>flags</h4>
130              </div>
131            </div>
132          </div>
133          <p>
134                The <span class="bold"><strong>flags</strong></span> parameter must
135                be set to 0 or the following value:
136            </p>
137          <div class="itemizedlist">
138            <ul type="disc">
139              <li>
140                <p>
141                        <code class="literal">DB_AUTO_COMMIT</code>
142                    </p>
143                <p>
144                        Enclose the <code class="classname">DbEnv::dbremove()</code>
145                        call within a transaction. If the call succeeds,
146                        changes made by the operation will be recoverable.
147                        If the call fails, the operation will have made no
148                        changes.
149                    </p>
150              </li>
151            </ul>
152          </div>
153        </div>
154      </div>
155      <div class="sect2" lang="en" xml:lang="en">
156        <div class="titlepage">
157          <div>
158            <div>
159              <h3 class="title"><a id="id1663249"></a>Environment Variables</h3>
160            </div>
161          </div>
162        </div>
163        <p>
164                         The  environment variable <code class="literal">DB_HOME</code> may be used as the path of
165                         the database environment home.
166                    </p>
167      </div>
168      <div class="sect2" lang="en" xml:lang="en">
169        <div class="titlepage">
170          <div>
171            <div>
172              <h3 class="title"><a id="id1663562"></a>Errors</h3>
173            </div>
174          </div>
175        </div>
176        <p>
177                         The <code class="methodname">DbEnv::dbremove()</code> <span>
178            
179            <span>
180                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
181                exception, encapsulating one of the following non-zero errors, or return one
182                of the following non-zero errors:
183            </span>
184        </span>
185                    </p>
186        <div class="sect3" lang="en" xml:lang="en">
187          <div class="titlepage">
188            <div>
189              <div>
190                <h4 class="title"><a id="id1663636"></a><span>DbDeadlockException or </span>DB_LOCK_DEADLOCK</h4>
191              </div>
192            </div>
193          </div>
194          <p>
195                A transactional database environment operation was selected to resolve
196                a deadlock.
197            </p>
198          <p>
199                <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if
200                your Berkeley DB API is configured to throw exceptions.
201                Otherwise, <code class="literal">DB_LOCK_DEADLOCK</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="id1663446"></a><span>DbLockNotGrantedException or </span>DB_LOCK_NOTGRANTED</h4>
209              </div>
210            </div>
211          </div>
212          <p>
213                A Berkeley DB Concurrent Data Store database environment configured
214                for lock timeouts was unable to grant a lock in the allowed time.
215            </p>
216          <p>
217                <a class="xref" href="dblocknotgranted.html" title="DbLockNotGrantedException">DbLockNotGrantedException</a> is thrown if
218                your Berkeley DB API is configured to throw exceptions.
219                Otherwise, <code class="literal">DB_LOCK_NOTGRANTED</code> is returned.
220            </p>
221        </div>
222        <div class="sect3" lang="en" xml:lang="en">
223          <div class="titlepage">
224            <div>
225              <div>
226                <h4 class="title"><a id="id1663425"></a>EINVAL</h4>
227              </div>
228            </div>
229          </div>
230          <p>
231                If the method was called before <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> 
232                was called; or if an invalid flag value or parameter was specified.
233            </p>
234        </div>
235        <div class="sect3" lang="en" xml:lang="en">
236          <div class="titlepage">
237            <div>
238              <div>
239                <h4 class="title"><a id="id1663431"></a>ENOENT</h4>
240              </div>
241            </div>
242          </div>
243          <p>
244                The file or directory does not exist.
245            </p>
246        </div>
247      </div>
248      <div class="sect2" lang="en" xml:lang="en">
249        <div class="titlepage">
250          <div>
251            <div>
252              <h3 class="title"><a id="id1663642"></a>Class</h3>
253            </div>
254          </div>
255        </div>
256        <p>
257                <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  
258            </p>
259      </div>
260      <div class="sect2" lang="en" xml:lang="en">
261        <div class="titlepage">
262          <div>
263            <div>
264              <h3 class="title"><a id="id1663577"></a>See Also</h3>
265            </div>
266          </div>
267        </div>
268        <p>
269                     <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 
270                </p>
271      </div>
272    </div>
273    <div class="navfooter">
274      <hr />
275      <table width="100%" summary="Navigation footer">
276        <tr>
277          <td width="40%" align="left"><a accesskey="p" href="envcreate.html">Prev</a> </td>
278          <td width="20%" align="center">
279            <a accesskey="u" href="env.html">Up</a>
280          </td>
281          <td width="40%" align="right"> <a accesskey="n" href="envdbrename.html">Next</a></td>
282        </tr>
283        <tr>
284          <td width="40%" align="left" valign="top">DbEnv </td>
285          <td width="20%" align="center">
286            <a accesskey="h" href="index.html">Home</a>
287          </td>
288          <td width="40%" align="right" valign="top"> DbEnv::dbrename()</td>
289        </tr>
290      </table>
291    </div>
292  </body>
293</html>
294