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