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