File: env.html

package info (click to toggle)
db 2%3A2.4.14-2.7.7.1.c
  • links: PTS
  • area: main
  • in suites: potato
  • size: 12,716 kB
  • ctags: 9,382
  • sloc: ansic: 35,556; tcl: 8,564; cpp: 4,890; sh: 2,075; makefile: 1,723; java: 1,632; sed: 419; awk: 153; asm: 41
file content (82 lines) | stat: -rw-r--r-- 4,522 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<! "@(#)env.so	10.7 (Sleepycat) 10/6/98">
<!Copyright 1997, 1998 by Sleepycat Software, Inc.  All rights reserved.>
<html>
<body bgcolor=white>
<head>
<title>Berkeley DB: Berkeley DB Database Environment</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btr
ee,hash,hashing,transaction,transactions,locking,logging,access method,access me
thods,java,C,C++">
</head>
<h1>Berkeley DB Database Environment</h1>
<hr size=1 noshade>
<tt>
The database access methods make calls to the other subsystems in the
Berkeley DB library
based on the <b>dbenv</b> argument to <a href="../../api_c/Db/open.html">db_open</a> which is a pointer to
a structure of type DB_ENV.  Applications normally use the same DB_ENV
structure (initialized by <a href="../../api_c/DbEnv/appinit.html">db_appinit</a>) as an argument to all of
the subsystems in the Berkeley DB package.
<p>
References to the DB_ENV structure are maintained by Berkeley DB, so it may not
be discarded until the last close function, corresponding to an open
function for which it was an argument, has returned.  To ensure
compatibility with future releases of Berkeley DB, all fields of the DB_ENV
structure that are not explicitly set should be initialized to 0 before
the first time the structure is used.  Do this by declaring the structure
external or static, or by calling one of the C library routines
<b>bzero</b>(3) or <b>memset</b>(3).
<p>
The fields of the DB_ENV structure used by <a href="../../api_c/Db/open.html">db_open</a> are described below.
If <b>dbenv</b> is NULL or any of its fields are set to 0, defaults
appropriate for the system are used where possible.
<p>
The following fields in the DB_ENV structure may be initialized before
calling <a href="../../api_c/Db/open.html">db_open</a>:
<p>
<dl compact>
<a name="lg_info">
<p><dt>DB_LOG *lg_info;<dd>If modifications to the file being opened should be logged, the
<b>lg_info</b> field contains a return value from the function
<a href="../../api_c/DbLog/open.html">log_open</a>.
If <b>lg_info</b> is NULL, no logging is done by the Berkeley DB access methods.
<a name="lk_info">
<p><dt>DB_LOCKTAB *lk_info;<dd>If locking is required for the file being opened (as is the case
when multiple processes or threads are accessing the same file), the
<b>lk_info</b> field contains a return value from the function
<a href="../../api_c/DbLockTab/open.html">lock_open</a>.
If <b>lk_info</b> is NULL, no locking is done by the Berkeley DB access methods.
<p>
If both locking and transactions are being performed (i.e., both
<b>lk_info</b> and <b>tx_info</b> are non-NULL), the transaction
ID will be used as the locker ID.
If only locking is being performed, <a href="../../api_c/Db/open.html">db_open</a> will acquire a
locker ID from <a href="../../api_c/DbLockTab/id.html">lock_id</a> and will use it for all locks required
for this instance of <a href="../../api_c/Db/open.html">db_open</a>.
<a name="mp_info">
<p><dt>DB_MPOOL *mp_info;<dd>If the cache for the file being opened should be maintained in a shared
buffer pool, the <b>mp_info</b> field contains a return value from the
function <a href="../../api_c/DbMpool/open.html">memp_open</a>.
If <b>mp_info</b> is NULL, a memory pool may still be created by Berkeley DB,
but it will be private to the application and entirely managed by Berkeley DB.
<a name="tx_info">
<p><dt>DB_TXNMGR *tx_info;<dd>If the accesses to the file being opened should take place in the context
of transactions (providing atomicity and error recovery), the <b>tx_info</b>
field contains a return value from the function
<a href="../../api_c/DbTxnMgr/open.html">txn_open</a>.
If transactions are specified, the application is responsible for making
suitable calls to <a href="../../api_c/DbTxnMgr/begin.html">txn_begin</a>, <a href="../../api_c/DbTxn/abort.html">txn_abort</a> and
<a href="../../api_c/DbTxn/commit.html">txn_commit</a>.  If <b>tx_info</b> is NULL, no transaction support
is done by the Berkeley DB access methods.
<p>
When the access methods are used in conjunction with transactions,
the application must abort the transaction (using <a href="../../api_c/DbTxn/abort.html">txn_abort</a>)
if any of the transaction protected access method calls (i.e.,
any calls other than open, close and sync) returns a
<a href="../../ref/program/errorret.html">system error</a>
(e.g., deadlock, which returns EAGAIN).
</dl>
</tt>
</body>
</html>