summaryrefslogtreecommitdiff
path: root/bdb/docs/ref/simple_tut/close.html
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/docs/ref/simple_tut/close.html')
-rw-r--r--bdb/docs/ref/simple_tut/close.html102
1 files changed, 0 insertions, 102 deletions
diff --git a/bdb/docs/ref/simple_tut/close.html b/bdb/docs/ref/simple_tut/close.html
deleted file mode 100644
index a268a591c7d..00000000000
--- a/bdb/docs/ref/simple_tut/close.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<!--$Id: close.so,v 10.22 2000/12/18 21:05:15 bostic Exp $-->
-<!--Copyright 1997, 1998, 1999, 2000 by Sleepycat Software, Inc.-->
-<!--All rights reserved.-->
-<html>
-<head>
-<title>Berkeley DB Reference Guide: Closing a database</title>
-<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
-<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
-</head>
-<body bgcolor=white>
-<table><tr valign=top>
-<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Simple Tutorial</dl></h3></td>
-<td width="1%"><a href="../../ref/simple_tut/del.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../ref/toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/am_conf/intro.html"><img src="../../images/next.gif" alt="Next"></a>
-</td></tr></table>
-<p>
-<h1 align=center>Closing a database</h1>
-<p>The only other operation that we need for our simple example is closing
-the database, and cleaning up the DB handle.
-<p>It is necessary that the database be closed. The most important reason
-for this is that Berkeley DB runs on top of an underlying buffer cache. If
-the modified database pages are never explicitly flushed to disk and
-the database is never closed, changes made to the database may never
-make it out to disk, because they are held in the Berkeley DB cache. As the
-default behavior of the close function is to flush the Berkeley DB cache,
-closing the database will update the on-disk information.
-<p>The <a href="../../api_c/db_close.html">DB-&gt;close</a> interface takes two arguments:
-<p><dl compact>
-<p><dt>db<dd>The database handle returned by <a href="../../api_c/db_create.html">db_create</a>.
-<p><dt>flags<dd>Optional flags modifying the underlying behavior of the <a href="../../api_c/db_close.html">DB-&gt;close</a>
-interface.
-</dl>
-<p>Here's what the code to call <a href="../../api_c/db_close.html">DB-&gt;close</a> looks like:
-<p><blockquote><pre>#include &lt;sys/types.h&gt;
-#include &lt;stdio.h&gt;
-#include &lt;db.h&gt;
-<p>
-#define DATABASE "access.db"
-<p>
-int
-main()
-{
- DB *dbp;
- DBT key, data;
- <b>int ret, t_ret;</b>
-<p>
- if ((ret = db_create(&dbp, NULL, 0)) != 0) {
- fprintf(stderr, "db_create: %s\n", db_strerror(ret));
- exit (1);
- }
- if ((ret = dbp-&gt;open(
- dbp, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
- dbp-&gt;err(dbp, ret, "%s", DATABASE);
- goto err;
- }
-<p>
- memset(&key, 0, sizeof(key));
- memset(&data, 0, sizeof(data));
- key.data = "fruit";
- key.size = sizeof("fruit");
- data.data = "apple";
- data.size = sizeof("apple");
-<p>
- if ((ret = dbp-&gt;put(dbp, NULL, &key, &data, 0)) == 0)
- printf("db: %s: key stored.\n", (char *)key.data);
- else {
- dbp-&gt;err(dbp, ret, "DB-&gt;put");
- goto err;
- }
-<p>
- if ((ret = dbp-&gt;get(dbp, NULL, &key, &data, 0)) == 0)
- printf("db: %s: key retrieved: data was %s.\n",
- (char *)key.data, (char *)data.data);
- else {
- dbp-&gt;err(dbp, ret, "DB-&gt;get");
- goto err;
- }
-<p>
- if ((ret = dbp-&gt;del(dbp, NULL, &key, 0)) == 0)
- printf("db: %s: key was deleted.\n", (char *)key.data);
- else {
- dbp-&gt;err(dbp, ret, "DB-&gt;del");
- goto err;
- }
-<p>
- if ((ret = dbp-&gt;get(dbp, NULL, &key, &data, 0)) == 0)
- printf("db: %s: key retrieved: data was %s.\n",
- (char *)key.data, (char *)data.data);
- else
- dbp-&gt;err(dbp, ret, "DB-&gt;get");
-<p><b>err: if ((t_ret = dbp-&gt;close(dbp, 0)) != 0 && ret == 0)
- ret = t_ret; </b>
-<p>
- exit(ret);
-}
-</pre></blockquote>
-<p>Note that we do not necessarily overwrite the <b>ret</b> variable, as it
-may contain error return information from a previous Berkeley DB call.
-<table><tr><td><br></td><td width="1%"><a href="../../ref/simple_tut/del.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../ref/toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/am_conf/intro.html"><img src="../../images/next.gif" alt="Next"></a>
-</td></tr></table>
-<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
-</body>
-</html>