~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/docs/ref/upgrade.3.0/open.html

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!--$Id$-->
2
 
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
 
<!--All rights reserved.-->
4
 
<!--See the file LICENSE for redistribution information.-->
5
 
<html>
6
 
<head>
7
 
<title>Berkeley DB Reference Guide: Release 3.0: database open/close</title>
8
 
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
 
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
10
 
</head>
11
 
<body bgcolor=white>
12
 
<table width="100%"><tr valign=top>
13
 
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td>
14
 
<td align=right><a href="../../ref/upgrade.3.0/dbenv.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.3.0/xa.html"><img src="../../images/next.gif" alt="Next"></a>
15
 
</td></tr></table>
16
 
<p>
17
 
<h1 align=center>Release 3.0: database open/close</h1>
18
 
<p>Database opens were changed in the Berkeley DB 3.0 release in a similar way to
19
 
environment opens.
20
 
<p>To upgrade your application, first find each place your application opens
21
 
a database, that is, calls the db_open function.  Each of these calls
22
 
should be replaced with calls to <a href="../../api_c/db_create.html">db_create</a> and <a href="../../api_c/db_open.html">DB-&gt;open</a>.
23
 
<p>Here's an example creating a Berkeley DB database using the 2.X interface:
24
 
<p><blockquote><pre>DB *dbp;
25
 
DB_ENV *dbenv;
26
 
int ret;
27
 
<p>
28
 
if ((ret = db_open(DATABASE,
29
 
    DB_BTREE, DB_CREATE, 0664, dbenv, NULL, &dbp)) != 0)
30
 
        return (ret);</pre></blockquote>
31
 
<p>In the Berkeley DB 3.0 release, this code would be written as:
32
 
<p><blockquote><pre>DB *dbp;
33
 
DB_ENV *dbenv;
34
 
int ret;
35
 
<p>
36
 
if ((ret = db_create(&dbp, dbenv, 0)) != 0)
37
 
        return (ret);
38
 
<p>
39
 
if ((ret = dbp-&gt;open(dbp,
40
 
    DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
41
 
        (void)dbp-&gt;close(dbp, 0);
42
 
        return (ret);
43
 
}</pre></blockquote>
44
 
<p>As you can see, the arguments to db_open and to <a href="../../api_c/db_open.html">DB-&gt;open</a> are
45
 
largely the same.  There is some re-organization, and note that the
46
 
enclosing <a href="../../api_c/env_class.html">DB_ENV</a> structure is specified when the <a href="../../api_c/db_class.html">DB</a> object
47
 
is created using the <a href="../../api_c/db_create.html">db_create</a> interface.  There is one
48
 
additional argument to <a href="../../api_c/db_open.html">DB-&gt;open</a>, argument #3.  For backward
49
 
compatibility with the 2.X Berkeley DB releases, simply set that argument to
50
 
NULL.
51
 
<p>There are two additional issues with the db_open call.
52
 
<p>First, it was possible in the 2.X releases for an application to provide
53
 
an environment that did not contain a shared memory buffer pool as the
54
 
database environment, and Berkeley DB would create a private one automatically.
55
 
This functionality is no longer available, applications must specify the
56
 
<a href="../../api_c/env_open.html#DB_INIT_MPOOL">DB_INIT_MPOOL</a> flag if databases are going to be opened in the
57
 
environment.
58
 
<p>The final issue with upgrading the db_open call is that the DB_INFO
59
 
structure is no longer used, having been replaced by individual methods
60
 
on the <a href="../../api_c/db_class.html">DB</a> handle.  That change is discussed in detail later in
61
 
this chapter.
62
 
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.3.0/dbenv.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.3.0/xa.html"><img src="../../images/next.gif" alt="Next"></a>
63
 
</td></tr></table>
64
 
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
65
 
</body>
66
 
</html>