Debian Codegraph @

docs/programmer_reference/am_close.html

raw symbols SCIP
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>Database close</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="Berkeley DB Programmer's Reference Guide" />
10 <link rel="up" href="am.html" title="Chapter 3.  Access Method Operations" />
11 <link rel="prev" href="am_sync.html" title="Flushing the database cache" />
12 <link rel="next" href="am_second.html" title="Secondary indexes" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">Database close</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="am_sync.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 3. 
26 Access Method Operations
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="am_second.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="am_close"></a>Database close</h2>
38 </div>
39 </div>
40 </div>
41 <p>The <a href="../api_reference/C/dbclose.html" class="olink">DB-&gt;close()</a> database handle closes the <a href="../api_reference/C/db.html" class="olink">DB</a> handle. By
42 default, <a href="../api_reference/C/dbclose.html" class="olink">DB-&gt;close()</a> also flushes all modified records from the
43 database cache to disk.</p>
44 <p>There is one flag that you can set to customize <a href="../api_reference/C/dbclose.html" class="olink">DB-&gt;close()</a>:</p>
45 <div class="variablelist">
46 <dl>
47 <dt>
48 <span class="term">
49 <a href="../api_reference/C/dbclose.html#dbclose_DB_NOSYNC" class="olink">DB_NOSYNC</a>
50 </span>
51 </dt>
52 <dd>Do not flush cached information to disk.</dd>
53 </dl>
54 </div>
55 <span class="bold">
56 <strong>It is important to understand that flushing cached information
57 to disk only minimizes the window of opportunity for corrupted data, it
58 does not eliminate the possibility.</strong>
59 </span>
60 <p>While unlikely, it is possible for database corruption to happen if a
61 system or application crash occurs while writing data to the database. To
62 ensure that database corruption never occurs, applications must either:</p>
63 <div class="itemizedlist">
64 <ul type="disc">
65 <li>Use transactions and logging with automatic recovery.</li>
66 <li>Use logging and application-specific recovery.</li>
67 <li>Edit a copy of the database, and, once all applications
68 using the database have successfully called <a href="../api_reference/C/dbclose.html" class="olink">DB-&gt;close()</a>, use
69 system operations (for example, the POSIX rename system call) to
70 atomically replace the original database with the updated copy.</li>
71 </ul>
72 </div>
73 </div>
74 <div class="navfooter">
75 <hr />
76 <table width="100%" summary="Navigation footer">
77 <tr>
78 <td width="40%" align="left"><a accesskey="p" href="am_sync.html">Prev</a> </td>
79 <td width="20%" align="center">
80 <a accesskey="u" href="am.html">Up</a>
81 </td>
82 <td width="40%" align="right"> <a accesskey="n" href="am_second.html">Next</a></td>
83 </tr>
84 <tr>
85 <td width="40%" align="left" valign="top">Flushing the database cache </td>
86 <td width="20%" align="center">
87 <a accesskey="h" href="index.html">Home</a>
88 </td>
89 <td width="40%" align="right" valign="top"> Secondary indexes</td>
90 </tr>
91 </table>
92 </div>
93 </body>
94 </html>