| 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->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="envdbbackup.html" title="DB_ENV->dbbackup()" /> |
| 12 | <link rel="next" href="envdbrename.html" title="DB_ENV->dbrename()" /> |
| 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_ENV->dbremove()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envdbbackup.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 5. |
| 26 | The DB_ENV Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envdbrename.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="envdbremove"></a>DB_ENV->dbremove()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->dbremove(DB_ENV *dbenv, DB_TXN *txnid, |
| 45 | const char *file, const char *database, u_int32_t flags); </pre> |
| 46 | <p> |
| 47 | The <code class="methodname">DB_ENV->dbremove()</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 | </p> |
| 57 | <p> |
| 58 | The <code class="methodname">DB_ENV->dbremove()</code> <span> |
| 59 | <span> |
| 60 | method returns a non-zero error value on failure and 0 on success. |
| 61 | </span> |
| 62 | |
| 63 | </span> |
| 64 | </p> |
| 65 | <p> |
| 66 | <code class="methodname">DB_ENV->dbremove()</code> is affected by any database directory specified using the |
| 67 | <a class="xref" href="envset_data_dir.html" title="DB_ENV->set_data_dir()">DB_ENV->set_data_dir()</a> |
| 68 | method, or by setting the <code class="literal">set_data_dir</code> string in the environment's |
| 69 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. |
| 70 | </p> |
| 71 | <div class="sect2" lang="en" xml:lang="en"> |
| 72 | <div class="titlepage"> |
| 73 | <div> |
| 74 | <div> |
| 75 | <h3 class="title"><a id="idp51342584"></a>Parameters</h3> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | <div class="sect3" lang="en" xml:lang="en"> |
| 80 | <div class="titlepage"> |
| 81 | <div> |
| 82 | <div> |
| 83 | <h4 class="title"><a id="idp51342776"></a>txnid</h4> |
| 84 | </div> |
| 85 | </div> |
| 86 | </div> |
| 87 | <p> |
| 88 | If the operation is part of an application-specified transaction, the |
| 89 | <span class="bold"><strong>txnid</strong></span> parameter is a transaction |
| 90 | handle returned from |
| 91 | <a class="xref" href="txnbegin.html" title="DB_ENV->txn_begin()">DB_ENV->txn_begin()</a>; if the |
| 92 | operation is part of a Berkeley DB Concurrent Data Store group, the |
| 93 | <span class="bold"><strong>txnid</strong></span> parameter is a handle returned |
| 94 | from <a class="xref" href="envcdsgroup_begin.html" title="DB_ENV->cdsgroup_begin()">DB_ENV->cdsgroup_begin()</a>; |
| 95 | otherwise NULL. If no transaction handle is specified, but the |
| 96 | <code class="literal">DB_AUTO_COMMIT</code> flag is specified to either this method |
| 97 | or the environment handle, the operation will be implicitly transaction protected. |
| 98 | </p> |
| 99 | </div> |
| 100 | <div class="sect3" lang="en" xml:lang="en"> |
| 101 | <div class="titlepage"> |
| 102 | <div> |
| 103 | <div> |
| 104 | <h4 class="title"><a id="idp51343832"></a>file</h4> |
| 105 | </div> |
| 106 | </div> |
| 107 | </div> |
| 108 | <p> |
| 109 | The <span class="bold"><strong>file</strong></span> parameter is the physical |
| 110 | file which contains the database(s) to be removed. |
| 111 | </p> |
| 112 | </div> |
| 113 | <div class="sect3" lang="en" xml:lang="en"> |
| 114 | <div class="titlepage"> |
| 115 | <div> |
| 116 | <div> |
| 117 | <h4 class="title"><a id="idp51328720"></a>database</h4> |
| 118 | </div> |
| 119 | </div> |
| 120 | </div> |
| 121 | <p> |
| 122 | The <span class="bold"><strong>database</strong></span> parameter is the |
| 123 | database to be removed. |
| 124 | </p> |
| 125 | </div> |
| 126 | <div class="sect3" lang="en" xml:lang="en"> |
| 127 | <div class="titlepage"> |
| 128 | <div> |
| 129 | <div> |
| 130 | <h4 class="title"><a id="idp51326760"></a>flags</h4> |
| 131 | </div> |
| 132 | </div> |
| 133 | </div> |
| 134 | <p> |
| 135 | The <span class="bold"><strong>flags</strong></span> parameter must |
| 136 | be set to 0 or the following value: |
| 137 | </p> |
| 138 | <div class="itemizedlist"> |
| 139 | <ul type="disc"> |
| 140 | <li> |
| 141 | <p> |
| 142 | <code class="literal">DB_AUTO_COMMIT</code> |
| 143 | </p> |
| 144 | <p> |
| 145 | Enclose the <code class="classname">DB_ENV->dbremove()</code> |
| 146 | call within a transaction. If the call succeeds, |
| 147 | changes made by the operation will be recoverable. |
| 148 | If the call fails, the operation will have made no |
| 149 | changes. |
| 150 | </p> |
| 151 | </li> |
| 152 | </ul> |
| 153 | </div> |
| 154 | </div> |
| 155 | </div> |
| 156 | <div class="sect2" lang="en" xml:lang="en"> |
| 157 | <div class="titlepage"> |
| 158 | <div> |
| 159 | <div> |
| 160 | <h3 class="title"><a id="idp51349912"></a>Environment Variables</h3> |
| 161 | </div> |
| 162 | </div> |
| 163 | </div> |
| 164 | <p> |
| 165 | The environment variable <code class="literal">DB_HOME</code> may be used as the path of |
| 166 | the database environment home. |
| 167 | </p> |
| 168 | </div> |
| 169 | <div class="sect2" lang="en" xml:lang="en"> |
| 170 | <div class="titlepage"> |
| 171 | <div> |
| 172 | <div> |
| 173 | <h3 class="title"><a id="idp51343208"></a>Errors</h3> |
| 174 | </div> |
| 175 | </div> |
| 176 | </div> |
| 177 | <p> |
| 178 | The <code class="methodname">DB_ENV->dbremove()</code> <span> |
| 179 | <span> |
| 180 | method may fail and return one of the following non-zero errors: |
| 181 | </span> |
| 182 | |
| 183 | </span> |
| 184 | </p> |
| 185 | <div class="sect3" lang="en" xml:lang="en"> |
| 186 | <div class="titlepage"> |
| 187 | <div> |
| 188 | <div> |
| 189 | <h4 class="title"><a id="idp51355424"></a>DB_LOCK_DEADLOCK</h4> |
| 190 | </div> |
| 191 | </div> |
| 192 | </div> |
| 193 | <p> |
| 194 | A transactional database environment operation was selected to resolve |
| 195 | a deadlock. |
| 196 | </p> |
| 197 | </div> |
| 198 | <div class="sect3" lang="en" xml:lang="en"> |
| 199 | <div class="titlepage"> |
| 200 | <div> |
| 201 | <div> |
| 202 | <h4 class="title"><a id="idp51344864"></a>DB_LOCK_NOTGRANTED</h4> |
| 203 | </div> |
| 204 | </div> |
| 205 | </div> |
| 206 | <p> |
| 207 | A Berkeley DB Concurrent Data Store database environment configured |
| 208 | for lock timeouts was unable to grant a lock in the allowed time. |
| 209 | </p> |
| 210 | <p> |
| 211 | You attempted to open a database handle that is configured |
| 212 | for no waiting exclusive locking, but the exclusive lock could not be |
| 213 | immediately obtained. See |
| 214 | <a class="xref" href="dbset_lk_exclusive.html" title="DB->set_lk_exclusive()">DB->set_lk_exclusive()</a> |
| 215 | for more information. |
| 216 | </p> |
| 217 | </div> |
| 218 | <div class="sect3" lang="en" xml:lang="en"> |
| 219 | <div class="titlepage"> |
| 220 | <div> |
| 221 | <div> |
| 222 | <h4 class="title"><a id="idp51346864"></a>EINVAL</h4> |
| 223 | </div> |
| 224 | </div> |
| 225 | </div> |
| 226 | <p> |
| 227 | If the method was called before <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> |
| 228 | was called; or if an invalid flag value or parameter was specified. |
| 229 | </p> |
| 230 | </div> |
| 231 | <div class="sect3" lang="en" xml:lang="en"> |
| 232 | <div class="titlepage"> |
| 233 | <div> |
| 234 | <div> |
| 235 | <h4 class="title"><a id="idp51318720"></a>ENOENT</h4> |
| 236 | </div> |
| 237 | </div> |
| 238 | </div> |
| 239 | <p> |
| 240 | The file or directory does not exist. |
| 241 | </p> |
| 242 | </div> |
| 243 | </div> |
| 244 | <div class="sect2" lang="en" xml:lang="en"> |
| 245 | <div class="titlepage"> |
| 246 | <div> |
| 247 | <div> |
| 248 | <h3 class="title"><a id="idp51354344"></a>Class</h3> |
| 249 | </div> |
| 250 | </div> |
| 251 | </div> |
| 252 | <p> |
| 253 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 254 | </p> |
| 255 | </div> |
| 256 | <div class="sect2" lang="en" xml:lang="en"> |
| 257 | <div class="titlepage"> |
| 258 | <div> |
| 259 | <div> |
| 260 | <h3 class="title"><a id="idp51358792"></a>See Also</h3> |
| 261 | </div> |
| 262 | </div> |
| 263 | </div> |
| 264 | <p> |
| 265 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 266 | </p> |
| 267 | </div> |
| 268 | </div> |
| 269 | <div class="navfooter"> |
| 270 | <hr /> |
| 271 | <table width="100%" summary="Navigation footer"> |
| 272 | <tr> |
| 273 | <td width="40%" align="left"><a accesskey="p" href="envdbbackup.html">Prev</a> </td> |
| 274 | <td width="20%" align="center"> |
| 275 | <a accesskey="u" href="env.html">Up</a> |
| 276 | </td> |
| 277 | <td width="40%" align="right"> <a accesskey="n" href="envdbrename.html">Next</a></td> |
| 278 | </tr> |
| 279 | <tr> |
| 280 | <td width="40%" align="left" valign="top">DB_ENV->dbbackup() </td> |
| 281 | <td width="20%" align="center"> |
| 282 | <a accesskey="h" href="index.html">Home</a> |
| 283 | </td> |
| 284 | <td width="40%" align="right" valign="top"> DB_ENV->dbrename()</td> |
| 285 | </tr> |
| 286 | </table> |
| 287 | </div> |
| 288 | </body> |
| 289 | </html> |