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		<tt class="classname">DB</tt> 
40		 
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                <tt class="methodname">DB-&gt;get_open_flags()</tt>
50                
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="c_db5"></a>
57            <pre class="programlisting">#include &lt;db.h&gt;
58...
59DB *dbp;
60u_int32_t open_flags;
61
62/* Database open and subsequent operations omitted for clarity */
63
64dbp-&gt;get_open_flags(dbp, &amp;open_flags); </pre>
65          </li>
66          <li>
67            <p>
68                <tt class="methodname">DB-&gt;remove()</tt>
69                
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="c_db6"></a>
81            <pre class="programlisting">#include &lt;db.h&gt;
82...
83DB *dbp;
84
85/* Database handle creation omitted for clarity */
86
87dbp-&gt;remove(dbp,                   /* Database pointer */
88            "mydb.db",             /* Database file to remove */
89            NULL,                  /* Database to remove. This is
90                                    * NULL so the entire file is
91                                    * removed.  */
92           0);                     /* Flags. None used. */</pre>
93          </li>
94          <li>
95            <p>
96                <tt class="methodname">DB-&gt;rename()</tt>
97                
98            </p>
99            <p>
100                Renames the specified database. If no value is given for the 
101				<i class="parameter"><tt>database</tt></i> parameter, then the entire file
102				referenced by this method is renamed.
103            </p>
104            <p>
105				Never rename a database that has handles opened for it. Never rename a file that
106				contains databases with opened handles.
107			</p>
108            <a id="c_db7"></a>
109            <pre class="programlisting">#include &lt;db.h&gt;
110...
111DB *dbp;
112
113/* Database handle creation omitted for clarity */
114
115dbp-&gt;rename(dbp,                    /* Database pointer */
116             "mydb.db",             /* Database file to rename */
117             NULL,                  /* Database to rename. This is
118                                     * NULL so the entire file is
119                                     * renamed.  */
120            "newdb.db",             /* New database file name */
121            0);                     /* Flags. None used. */</pre>
122          </li>
123        </ul>
124      </div>
125      <span>
126        
127    </span>
128    </div>
129    <div class="navfooter">
130      <hr />
131      <table width="100%" summary="Navigation footer">
132        <tr>
133          <td width="40%" align="left"><a accesskey="p" href="DBOpenFlags.html">Prev</a> </td>
134          <td width="20%" align="center">
135            <a accesskey="u" href="DB.html">Up</a>
136          </td>
137          <td width="40%" align="right"> <a accesskey="n" href="dbErrorReporting.html">Next</a></td>
138        </tr>
139        <tr>
140          <td width="40%" align="left" valign="top">Database Open Flags </td>
141          <td width="20%" align="center">
142            <a accesskey="h" href="index.html">Home</a>
143          </td>
144          <td width="40%" align="right" valign="top"> Error Reporting Functions</td>
145        </tr>
146      </table>
147    </div>
148  </body>
149</html>
150