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_cxx/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_cxx.h> 24<p> 25int 26Db::remove(const char *file, const char *database, u_int32_t flags); 27</pre></b> 28<hr size=1 noshade> 29<b>Description: Db::remove</b> 30<p>The Db::remove method removes the database specified by the 31<b>file</b> and <b>database</b> parameters. If no <b>database</b> 32is specified, the underlying file represented by <b>file</b> is 33removed, incidentally removing all of the databases it contained.</p> 34<p>Applications should never remove databases with open <a href="/api_cxx/db_class.html">Db</a> handles, 35or in the case of removing a file, when any database in the file has an 36open handle. For example, some architectures do not permit the removal 37of files with open system handles. On these architectures, attempts to 38remove databases currently in use by any thread of control in the system 39may fail.</p> 40<p>The Db::remove method should not be called if the remove is intended 41to be transactionally safe; the <a href="/api_cxx/env_dbremove.html">DbEnv::dbremove</a> method should be used 42instead.</p> 43<p>The Db::remove method may not be called after calling the 44<a href="/api_cxx/db_open.html">Db::open</a> method on any <a href="/api_cxx/db_class.html">Db</a> handle. If the <a href="/api_cxx/db_open.html">Db::open</a> method 45has already been called on a <a href="/api_cxx/db_class.html">Db</a> handle, close the existing 46handle and create a new one before calling Db::remove.</p> 47<p>The <a href="/api_cxx/db_class.html">Db</a> handle may not be accessed again after Db::remove is 48called, regardless of its return.</p> 49<p>The Db::remove method 50either returns a non-zero error value 51or throws an exception that encapsulates a non-zero error value on 52failure, and returns 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_cxx/env_set_data_dir.html">DbEnv::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 throw 73<a href="/api_cxx/except_class.html">DbException</a>, 74encapsulating one of the following non-zero errors, or return one of 75the following non-zero errors:</p> 76<br> 77<b>EINVAL</b><ul compact><li>If Db::remove called after <a href="/api_cxx/db_open.html">Db::open</a> was called; or if an 78invalid flag value or parameter was specified.</ul> 79<br> 80<br> 81<b>ENOENT</b><ul compact><li>The file or directory does not exist.</ul> 82<br> 83<hr size=1 noshade> 84<br><b>Class</b> 85<a href="/api_cxx/db_class.html">Db</a> 86<br><b>See Also</b> 87<a href="/api_cxx/db_list.html">Databases and Related Methods</a> 88</tt> 89<table width="100%"><tr><td><br></td><td align=right> 90<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a> 91</td></tr></table> 92<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 93</body> 94</html> 95