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>Administrative Methods</title> 7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Getting Started with Berkeley DB" /> 10 <link rel="up" href="DB.html" title="Chapter��2.��Databases" /> 11 <link rel="prev" href="DBOpenFlags.html" title="Database Open Flags" /> 12 <link rel="next" href="dbErrorReporting.html" title="Error Reporting Functions" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Administrative Methods</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="DBOpenFlags.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��2.��Databases</th> 23 <td width="20%" align="right">��<a accesskey="n" href="dbErrorReporting.html">Next</a></td> 24 </tr> 25 </table> 26 <hr /> 27 </div> 28 <div class="sect1" lang="en" xml:lang="en"> 29 <div class="titlepage"> 30 <div> 31 <div> 32 <h2 class="title" style="clear: both"><a id="CoreDBAdmin"></a>Administrative Methods</h2> 33 </div> 34 </div> 35 </div> 36 <p> 37 The following 38 39 <code class="classname">Db</code> 40 41 42 methods may be useful to you when managing DB databases: 43 </p> 44 <div class="itemizedlist"> 45 <ul type="disc"> 46 <li> 47 <p> 48 49 <code class="methodname">Db::get_open_flags()</code> 50 </p> 51 <p> 52 Returns the current open flags. It is an error to use this method on 53 an unopened database. 54 </p> 55 <a id="cxx_db5"></a> 56 <pre class="programlisting">#include <db_cxx.h> 57... 58Db db(NULL, 0); 59u_int32_t open_flags; 60 61// Database open and subsequent operations omitted for clarity 62 63db.get_open_flags(&open_flags); </pre> 64 </li> 65 <li> 66 <p> 67 68 <code class="methodname">Db::remove()</code> 69 </p> 70 <p> 71 Removes the specified database. If no value is given for the 72 <em class="parameter"><code>database</code></em> parameter, then the entire file 73 referenced by this method is removed. 74 </p> 75 <p> 76 Never remove a database that has handles opened for it. Never remove a file that 77 contains databases with opened handles. 78 </p> 79 <a id="cxx_db6"></a> 80 <pre class="programlisting">#include <db_cxx.h> 81... 82Db db(NULL, 0); 83 84// Database handle creation omitted for clarity 85 86db.remove("mydb.db", // Database file to remove 87 NULL, // Database to remove. This is 88 // NULL so the entire file is 89 // removed. 90 0); // Flags. None used.</pre> 91 </li> 92 <li> 93 <p> 94 95 <code class="methodname">Db::rename()</code> 96 </p> 97 <p> 98 Renames the specified database. If no value is given for the 99 <em class="parameter"><code>database</code></em> parameter, then the entire file 100 referenced by this method is renamed. 101 </p> 102 <p> 103 Never rename a database that has handles opened for it. Never rename a file that 104 contains databases with opened handles. 105 </p> 106 <a id="cxx_db7"></a> 107 <pre class="programlisting">#include <db_cxx.h> 108... 109Db db(NULL, 0); 110 111// Database handle creation omitted for clarity 112 113db.rename("mydb.db", // Database file to rename 114 NULL, // Database to rename. This is 115 // NULL so the entire file is 116 // renamed. 117 "newdb.db", // New database file name 118 0); // Flags. None used.</pre> 119 </li> 120 </ul> 121 </div> 122 <span> 123 124 </span> 125 </div> 126 <div class="navfooter"> 127 <hr /> 128 <table width="100%" summary="Navigation footer"> 129 <tr> 130 <td width="40%" align="left"><a accesskey="p" href="DBOpenFlags.html">Prev</a>��</td> 131 <td width="20%" align="center"> 132 <a accesskey="u" href="DB.html">Up</a> 133 </td> 134 <td width="40%" align="right">��<a accesskey="n" href="dbErrorReporting.html">Next</a></td> 135 </tr> 136 <tr> 137 <td width="40%" align="left" valign="top">Database Open Flags��</td> 138 <td width="20%" align="center"> 139 <a accesskey="h" href="index.html">Home</a> 140 </td> 141 <td width="40%" align="right" valign="top">��Error Reporting Functions</td> 142 </tr> 143 </table> 144 </div> 145 </body> 146</html> 147