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