• 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>Db::remove()</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="db.html" title="Chapter 2.  The Db Handle" />
11    <link rel="prev" href="dbput.html" title="Db::put()" />
12    <link rel="next" href="dbrename.html" title="Db::rename()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Db::remove()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="dbput.html">Prev</a> </td>
22          <th width="60%" align="center">Chapter 2. 
23                The Db Handle
24        </th>
25          <td width="20%" align="right"> <a accesskey="n" href="dbrename.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="dbremove"></a>Db::remove()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41Db::remove(const char *file, const char *database, u_int32_t flags);</pre>
42      <p>
43         The <code class="methodname">Db::remove()</code> method removes the database specified by the
44         <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
45         represented by <span class="bold"><strong>file</strong></span> is removed,
46         incidentally removing all of the databases it contained.
47    </p>
48      <p>
49         Applications should never remove databases with open 
50         <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  handles, or in the case of
51         removing a file, when any database in the file has an open handle. 
52         For example, some architectures do not permit the removal of files
53         with open system handles.  On these architectures, attempts to remove
54         databases currently in use by any thread of control in the system may
55         fail.
56    </p>
57      <p>
58         The <code class="methodname">Db::remove()</code> method should not be called if the remove is
59         intended to be transactionally safe; the 
60         <a class="xref" href="envdbremove.html" title="DbEnv::dbremove()">DbEnv::dbremove()</a> method
61         should be used instead.
62    </p>
63      <p>
64        The <code class="methodname">Db::remove()</code> method may not be called after calling the 
65        <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a>  method on any 
66        <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  handle.  If the 
67         <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> method has already
68         been called on a <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a> 
69         handle, close the existing handle and create a new one before calling
70         <code class="methodname">Db::remove.
71()</code>    </p>
72      <p>
73         The <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  handle may not be
74         accessed again after <code class="methodname">Db::remove()</code> is called, regardless of its
75         return.
76    </p>
77      <p>
78         The <code class="methodname">Db::remove()</code> <span>
79            
80            <span>
81                method either returns a non-zero error value or throws an
82                exception that encapsulates a non-zero error value on
83                failure, and returns 0 on success.
84            </span>
85        </span>
86    </p>
87      <div class="sect2" lang="en" xml:lang="en">
88        <div class="titlepage">
89          <div>
90            <div>
91              <h3 class="title"><a id="id1641922"></a>Parameters</h3>
92            </div>
93          </div>
94        </div>
95        <div class="sect3" lang="en" xml:lang="en">
96          <div class="titlepage">
97            <div>
98              <div>
99                <h4 class="title"><a id="id1641945"></a>database</h4>
100              </div>
101            </div>
102          </div>
103          <p>
104                          The <span class="bold"><strong>database</strong></span> parameter is the
105                          database to be removed.
106                     </p>
107        </div>
108        <div class="sect3" lang="en" xml:lang="en">
109          <div class="titlepage">
110            <div>
111              <div>
112                <h4 class="title"><a id="id1642028"></a>file</h4>
113              </div>
114            </div>
115          </div>
116          <p>
117                          The <span class="bold"><strong>file</strong></span> parameter is the physical
118                          file which contains the database(s) to be removed.
119                     </p>
120        </div>
121      </div>
122      <div class="sect2" lang="en" xml:lang="en">
123        <div class="titlepage">
124          <div>
125            <div>
126              <h3 class="title"><a id="id1642041"></a>Environment Variables</h3>
127            </div>
128          </div>
129        </div>
130        <p>
131                         If the database was opened within a database environment, the
132                         environment variable <code class="literal">DB_HOME</code> may be used as the path of the
133                         database environment home.
134                    </p>
135        <p>
136                            <code class="methodname">Db::remove()</code> is affected by any database directory specified using the
137                            <a class="xref" href="envset_data_dir.html" title="DbEnv::set_data_dir()">DbEnv::set_data_dir()</a>
138                            method, or by setting the "set_data_dir" string in the environment's
139                            <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
140                            file.
141                    </p>
142      </div>
143      <div class="sect2" lang="en" xml:lang="en">
144        <div class="titlepage">
145          <div>
146            <div>
147              <h3 class="title"><a id="id1642008"></a>Errors</h3>
148            </div>
149          </div>
150        </div>
151        <p>
152                         The <code class="methodname">Db::remove()</code> <span>
153            
154            <span>
155                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
156                exception, encapsulating one of the following non-zero errors, or return one
157                of the following non-zero errors:
158            </span>
159        </span>
160                    </p>
161        <div class="sect3" lang="en" xml:lang="en">
162          <div class="titlepage">
163            <div>
164              <div>
165                <h4 class="title"><a id="id1641928"></a>EINVAL</h4>
166              </div>
167            </div>
168          </div>
169          <p>
170                If the method was called after <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> 
171                was called; or if an invalid flag value or parameter was specified.
172            </p>
173        </div>
174        <div class="sect3" lang="en" xml:lang="en">
175          <div class="titlepage">
176            <div>
177              <div>
178                <h4 class="title"><a id="id1641939"></a>ENOENT</h4>
179              </div>
180            </div>
181          </div>
182          <p>
183                The file or directory does not exist.
184            </p>
185        </div>
186      </div>
187      <div class="sect2" lang="en" xml:lang="en">
188        <div class="titlepage">
189          <div>
190            <div>
191              <h3 class="title"><a id="id1641936"></a>Class</h3>
192            </div>
193          </div>
194        </div>
195        <p>
196                <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  
197            </p>
198      </div>
199      <div class="sect2" lang="en" xml:lang="en">
200        <div class="titlepage">
201          <div>
202            <div>
203              <h3 class="title"><a id="id1641871"></a>See Also</h3>
204            </div>
205          </div>
206        </div>
207        <p>
208                     <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 
209                </p>
210      </div>
211    </div>
212    <div class="navfooter">
213      <hr />
214      <table width="100%" summary="Navigation footer">
215        <tr>
216          <td width="40%" align="left"><a accesskey="p" href="dbput.html">Prev</a> </td>
217          <td width="20%" align="center">
218            <a accesskey="u" href="db.html">Up</a>
219          </td>
220          <td width="40%" align="right"> <a accesskey="n" href="dbrename.html">Next</a></td>
221        </tr>
222        <tr>
223          <td width="40%" align="left" valign="top">Db::put() </td>
224          <td width="20%" align="center">
225            <a accesskey="h" href="index.html">Home</a>
226          </td>
227          <td width="40%" align="right" valign="top"> Db::rename()</td>
228        </tr>
229      </table>
230    </div>
231  </body>
232</html>
233