1<!--$Id: db_remove.so,v 10.3 2002/08/18 21:15:51 bostic Exp $--> 2<!--$Id: env_dbremove.so,v 10.49 2004/12/16 19:13:01 bostic Exp $--> 3<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 4<!--See the file LICENSE for redistribution information.--> 5<html> 6<head> 7<title>Berkeley DB: DB->remove</title> 8<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 9<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 10</head> 11<body bgcolor=white> 12<table width="100%"><tr valign=top> 13<td> 14<b>DB->remove</b> 15</td> 16<td align=right> 17<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a> 18<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 19</tr></table> 20<hr size=1 noshade> 21<tt> 22<b><pre> 23#include <db.h> 24<p> 25int 26DB->remove(DB *db, 27 const char *file, const char *database, u_int32_t flags); 28</pre></b> 29<hr size=1 noshade> 30<b>Description: DB->remove</b> 31<p>The DB->remove method removes the database specified by the 32<b>file</b> and <b>database</b> parameters. If no <b>database</b> 33is specified, the underlying file represented by <b>file</b> is 34removed, incidentally removing all of the databases it contained.</p> 35<p>Applications should never remove databases with open <a href="../api_c/db_class.html">DB</a> handles, 36or in the case of removing a file, when any database in the file has an 37open handle. For example, some architectures do not permit the removal 38of files with open system handles. On these architectures, attempts to 39remove databases currently in use by any thread of control in the system 40may fail.</p> 41<p>The DB->remove method should not be called if the remove is intended 42to be transactionally safe; the <a href="../api_c/env_dbremove.html">DB_ENV->dbremove</a> method should be used 43instead.</p> 44<p>The DB->remove method may not be called after calling the 45<a href="../api_c/db_open.html">DB->open</a> method on any <a href="../api_c/db_class.html">DB</a> handle. If the <a href="../api_c/db_open.html">DB->open</a> method 46has already been called on a <a href="../api_c/db_class.html">DB</a> handle, close the existing 47handle and create a new one before calling DB->remove.</p> 48<p>The <a href="../api_c/db_class.html">DB</a> handle may not be accessed again after DB->remove is 49called, regardless of its return.</p> 50<p>The DB->remove method 51returns a non-zero error value on failure 52and 0 on success. 53</p> 54<b>Parameters</b> <br> 55 <b>database</b><ul compact><li>The <b>database</b> parameter is the database to be removed.</ul> 56 <b>file</b><ul compact><li>The <b>file</b> parameter is the physical file which contains the 57database(s) to be removed.</ul> 58<p>When using a Unicode build on Windows (the default), the <b>file</b> 59argument will be interpreted as a UTF-8 string, which is equivalent to 60ASCII for Latin characters.</p> 61 <b>flags</b><ul compact><li>The <b>flags</b> parameter is currently unused, and must be set to 0.</ul> 62<br> 63<br><b>Environment Variables</b> 64<p>If the database was opened within a database environment, the 65environment variable <b>DB_HOME</b> may be used as the path of the 66database environment home.</p> 67<p>DB->remove is affected by any database directory specified using 68the <a href="../api_c/env_set_data_dir.html">DB_ENV->set_data_dir</a> method, or by setting the "set_data_dir" string 69in the environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.</p> 70<br><b>Errors</b> 71<p>The DB->remove method 72may fail and return one of the following non-zero errors:</p> 73<br> 74<b>EINVAL</b><ul compact><li>If DB->remove called after <a href="../api_c/db_open.html">DB->open</a> was called; or if an 75invalid flag value or parameter was specified.</ul> 76<br> 77<br> 78<b>ENOENT</b><ul compact><li>The file or directory does not exist.</ul> 79<br> 80<hr size=1 noshade> 81<br><b>Class</b> 82<a href="../api_c/db_class.html">DB</a> 83<br><b>See Also</b> 84<a href="../api_c/db_list.html">Databases and Related Methods</a> 85</tt> 86<table width="100%"><tr><td><br></td><td align=right> 87<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 88</td></tr></table> 89<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 90</body> 91</html> 92