• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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>DbEnv::close()</title>
7    <link rel="stylesheet" href="apiReference.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9    <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10    <link rel="up" href="env.html" title="Chapter 5.  The DbEnv Handle" />
11    <link rel="prev" href="envadd_data_dir.html" title="DbEnv::add_data_dir()" />
12    <link rel="next" href="envcreate.html" title="DbEnv" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DbEnv::close()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="envadd_data_dir.html">Prev</a> </td>
22          <th width="60%" align="center">Chapter 5. 
23                The DbEnv Handle
24        </th>
25          <td width="20%" align="right"> <a accesskey="n" href="envcreate.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="envclose"></a>DbEnv::close()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40DbEnv::close(u_int32_t flags);</pre>
41      <p>
42         The <code class="methodname">DbEnv::close()</code> method closes the Berkeley DB environment,
43         freeing any allocated resources and closing any underlying subsystems.
44    </p>
45      <p>
46         The <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  handle should
47         not be closed while any other handle that refers to it is not yet
48         closed; for example, database environment handles must not be closed
49         while database handles remain open, or transactions in the environment
50         have not yet been committed or aborted. Specifically, this includes the
51         <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>, 
52         <a class="link" href="dbc.html" title="Chapter 3.  The Dbc Handle">Dbc</a>, 
53         <a class="link" href="txn.html" title="Chapter 13.  The DbTxn Handle">DbTxn</a>, 
54         <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>  and 
55         <a class="link" href="memp.html" title="Chapter 9.  The DbMpoolFile Handle">DbMpoolFile</a>  handles.
56    </p>
57      <p>
58         Where the environment was initialized with the 
59         <a class="link" href="envopen.html#envopen_DB_INIT_LOCK">DB_INIT_LOCK</a>  flag,
60         calling <code class="methodname">DbEnv::close()</code> does not release any locks still held by the
61         closing process, providing functionality for long-lived locks.
62         Processes that want to have all their locks released can do so by
63         issuing the appropriate <a class="xref" href="lockvec.html" title="DbEnv::lock_vec()">DbEnv::lock_vec()</a>  call.
64    </p>
65      <p>
66         Where the environment was initialized with the 
67         <a class="link" href="envopen.html#envopen_DB_INIT_MPOOL">DB_INIT_MPOOL</a> flag,
68         calling <code class="methodname">DbEnv::close()</code> implies calls to 
69         <a class="xref" href="mempfclose.html" title="DbMpoolFile::close()">DbMpoolFile::close()</a>  for any
70         remaining open files in the memory pool that were returned to this
71         process by calls to <a class="xref" href="mempfopen.html" title="DbMpoolFile::open()">DbMpoolFile::open()</a>.  It does
72         not imply a call to <a class="xref" href="mempfsync.html" title="DbMpoolFile::sync()">DbMpoolFile::sync()</a>  for those
73         files.
74    </p>
75      <p>
76         Where the environment was initialized with the 
77         <a class="link" href="envopen.html#envopen_DB_INIT_TXN">DB_INIT_TXN</a>  flag,
78         calling <code class="methodname">DbEnv::close()</code> aborts any unresolved transactions.
79         Applications should not depend on this behavior for transactions
80         involving Berkeley DB databases; all such transactions should be
81         explicitly resolved.  The problem with depending on this semantic is
82         that aborting an unresolved transaction involving database operations
83         requires a database handle.  Because the database handles should have
84         been closed before calling <code class="methodname">DbEnv::close()</code>, it will not be possible
85         to abort the transaction, and recovery will have to be run on the
86         Berkeley DB environment before further operations are done.
87    </p>
88      <p>
89         Where log cursors were created using the 
90         <a class="xref" href="logcursor.html" title="DbEnv::log_cursor()">DbEnv::log_cursor()</a>  method,
91         calling <code class="methodname">DbEnv::close()</code> does not imply closing those cursors.
92    </p>
93      <p>
94         In multithreaded applications, only a single thread may call the
95         <code class="methodname">DbEnv::close()</code> method.
96     </p>
97      <p>
98         After <code class="methodname">DbEnv::close()</code> has been called, regardless of its return, the
99         Berkeley DB environment handle may not be accessed again.
100    </p>
101      <p>
102         The <code class="methodname">DbEnv::close()</code> <span>
103            
104            <span>
105                method either returns a non-zero error value or throws an
106                exception that encapsulates a non-zero error value on
107                failure, and returns 0 on success.
108            </span>
109        </span>
110    </p>
111      <div class="sect2" lang="en" xml:lang="en">
112        <div class="titlepage">
113          <div>
114            <div>
115              <h3 class="title"><a id="id1662940"></a>Parameters</h3>
116            </div>
117          </div>
118        </div>
119        <div class="sect3" lang="en" xml:lang="en">
120          <div class="titlepage">
121            <div>
122              <div>
123                <h4 class="title"><a id="id1662944"></a>flags</h4>
124              </div>
125            </div>
126          </div>
127          <p>
128                          The <span class="bold"><strong>flags</strong></span> parameter is currently
129                          unused, and must be set to 0.
130                     </p>
131        </div>
132      </div>
133      <div class="sect2" lang="en" xml:lang="en">
134        <div class="titlepage">
135          <div>
136            <div>
137              <h3 class="title"><a id="id1663093"></a>Class</h3>
138            </div>
139          </div>
140        </div>
141        <p>
142                <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  
143            </p>
144      </div>
145      <div class="sect2" lang="en" xml:lang="en">
146        <div class="titlepage">
147          <div>
148            <div>
149              <h3 class="title"><a id="id1662241"></a>See Also</h3>
150            </div>
151          </div>
152        </div>
153        <p>
154                     <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 
155                </p>
156      </div>
157    </div>
158    <div class="navfooter">
159      <hr />
160      <table width="100%" summary="Navigation footer">
161        <tr>
162          <td width="40%" align="left"><a accesskey="p" href="envadd_data_dir.html">Prev</a> </td>
163          <td width="20%" align="center">
164            <a accesskey="u" href="env.html">Up</a>
165          </td>
166          <td width="40%" align="right"> <a accesskey="n" href="envcreate.html">Next</a></td>
167        </tr>
168        <tr>
169          <td width="40%" align="left" valign="top">DbEnv::add_data_dir() </td>
170          <td width="20%" align="center">
171            <a accesskey="h" href="index.html">Home</a>
172          </td>
173          <td width="40%" align="right" valign="top"> DbEnv</td>
174        </tr>
175      </table>
176    </div>
177  </body>
178</html>
179