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

« back to all changes in this revision

Viewing changes to libdb/docs/api_cxx/db_set_flags.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: Db::set_flags</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
 
<a name="2"><!--meow--></a>
13
 
<table width="100%"><tr valign=top>
14
 
<td>
15
 
<h1>Db::set_flags</h1>
16
 
</td>
17
 
<td align=right>
18
 
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
19
 
</td></tr></table>
20
 
<hr size=1 noshade>
21
 
<tt>
22
 
<h3><pre>
23
 
#include &lt;db_cxx.h&gt;
24
 
<p>
25
 
int
26
 
Db::set_flags(u_int32_t flags);
27
 
</pre></h3>
28
 
<h1>Description</h1>
29
 
<p>Calling Db::set_flags is additive; there is no way to clear flags.
30
 
<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or
31
 
more of the following values:
32
 
<h3>General</h3>
33
 
<p>The following flags may be specified for any Berkeley DB access method:
34
 
<p><dl compact>
35
 
<a name="3"><!--meow--></a>
36
 
<p><dt><a name="DB_CHKSUM_SHA1">DB_CHKSUM_SHA1</a><dd>Do checksum verification of pages read into the cache from the backing
37
 
filestore, using the SHA1 Secure Hash Algorithm.
38
 
<p>Calling Db::set_flags with the DB_CHKSUM_SHA1 flag only affects the
39
 
specified <a href="../api_cxx/db_class.html">Db</a> handle (and any other Berkeley DB handles opened within
40
 
the scope of that handle).
41
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_CHKSUM_SHA1
42
 
flag
43
 
will be ignored.
44
 
If creating additional databases in a file, the checksum behavior specified
45
 
must be consistent with the existing databases in the file or an error will
46
 
be returned.
47
 
<a name="4"><!--meow--></a>
48
 
<p><dt><a name="DB_ENCRYPT">DB_ENCRYPT</a><dd>Encrypt the database using the cryptographic password specified to the
49
 
<a href="../api_cxx/env_set_encrypt.html">DbEnv::set_encrypt</a> or <a href="../api_cxx/db_set_encrypt.html">Db::set_encrypt</a> methods.
50
 
<p>Calling Db::set_flags with the DB_ENCRYPT flag only affects the
51
 
specified <a href="../api_cxx/db_class.html">Db</a> handle (and any other Berkeley DB handles opened within
52
 
the scope of that handle).
53
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_ENCRYPT
54
 
flag
55
 
must be the same as the existing database or an error
56
 
will be returned.
57
 
If creating additional databases in a file, the encryption behavior specified
58
 
must be consistent with the existing databases in the file or an error will
59
 
be returned.
60
 
</dl>
61
 
<h3>Btree</h3>
62
 
<p>The following flags may be specified for the Btree access method:
63
 
<p><dl compact>
64
 
<a name="5"><!--meow--></a>
65
 
<p><dt><a name="DB_DUP">DB_DUP</a><dd>Permit duplicate data items in the tree; that is, insertion when the
66
 
key of the key/data pair being inserted already exists in the tree will
67
 
be successful.  The ordering of duplicates in the tree is determined by
68
 
the order of insertion, unless the ordering is otherwise specified by
69
 
use of a cursor operation.  It is an error to specify both DB_DUP
70
 
and DB_RECNUM.
71
 
<p>Calling Db::set_flags with the DB_DUP flag affects the
72
 
database, including all threads of control accessing the database.
73
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_DUP
74
 
flag
75
 
must be the same as the existing database or an error
76
 
will be returned.
77
 
<a name="6"><!--meow--></a>
78
 
<p><dt><a name="DB_DUPSORT">DB_DUPSORT</a><dd>Permit duplicate data items in the tree; that is, insertion when the
79
 
key of the key/data pair being inserted already exists in the tree will
80
 
be successful.  The ordering of duplicates in the tree is determined by
81
 
the duplicate comparison function.
82
 
If the application does not specify a comparison function using the
83
 
<a href="../api_cxx/db_set_dup_compare.html">Db::set_dup_compare</a> method, a default lexical comparison will be
84
 
used.
85
 
It is an error to specify both DB_DUPSORT and DB_RECNUM.
86
 
<p>Calling Db::set_flags with the DB_DUPSORT flag affects the
87
 
database, including all threads of control accessing the database.
88
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_DUPSORT
89
 
flag
90
 
must be the same as the existing database or an error
91
 
will be returned.
92
 
<a name="7"><!--meow--></a>
93
 
<p><dt><a name="DB_RECNUM">DB_RECNUM</a><dd>Support retrieval from the Btree using record numbers.  For more
94
 
information, see the <a href="../api_cxx/db_get.html#DB_SET_RECNO">DB_SET_RECNO</a> flag to the <a href="../api_cxx/db_get.html">Db::get</a>
95
 
and <a href="../api_cxx/dbc_get.html">Dbc::get</a> methods.
96
 
<p>Logical record numbers in Btree databases are mutable in the face of
97
 
record insertion or deletion.  See the DB_RENUMBER flag in the
98
 
Recno access method information for further discussion.
99
 
<p>Maintaining record counts within a Btree introduces a serious point of
100
 
contention, namely the page locations where the record counts are
101
 
stored.  In addition, the entire tree must be locked during both
102
 
insertions and deletions, effectively single-threading the tree for
103
 
those operations.  Specifying DB_RECNUM can result in serious
104
 
performance degradation for some applications and data sets.
105
 
<p>It is an error to specify both DB_DUP and DB_RECNUM.
106
 
<p>Calling Db::set_flags with the DB_RECNUM flag affects the
107
 
database, including all threads of control accessing the database.
108
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_RECNUM
109
 
flag
110
 
must be the same as the existing database or an error
111
 
will be returned.
112
 
<a name="8"><!--meow--></a><a name="9"><!--meow--></a>
113
 
<p><dt><a name="DB_REVSPLITOFF">DB_REVSPLITOFF</a><dd>Turn off reverse splitting in the Btree.  As pages are emptied in a
114
 
database, the Berkeley DB Btree implementation attempts to coalesce empty pages
115
 
into higher-level pages in order to keep the tree as small as possible
116
 
and minimize tree search time.  This can hurt performance in applications
117
 
with cyclical data demands; that is, applications where the database grows
118
 
and shrinks repeatedly.  For example, because Berkeley DB does page-level
119
 
locking, the maximum level of concurrency in a database of two pages is far
120
 
smaller than that in a database of 100 pages, so a database that has
121
 
shrunk to a minimal size can cause severe deadlocking when a new cycle of
122
 
data insertion begins.
123
 
<p>Calling Db::set_flags with the DB_REVSPLITOFF flag only affects the
124
 
specified <a href="../api_cxx/db_class.html">Db</a> handle (and any other Berkeley DB handles opened within
125
 
the scope of that handle).
126
 
</dl>
127
 
<h3>Hash</h3>
128
 
<p>The following flags may be specified for the Hash access method:
129
 
<p><dl compact>
130
 
<p><dt><a name="DB_DUP">DB_DUP</a><dd>Permit duplicate data items in the tree; that is, insertion when the
131
 
key of the key/data pair being inserted already exists in the tree will
132
 
be successful.  The ordering of duplicates in the tree is determined by
133
 
the order of insertion, unless the ordering is otherwise specified by
134
 
use of a cursor operation.  It is an error to specify both DB_DUP
135
 
and DB_RECNUM.
136
 
<p>Calling Db::set_flags with the DB_DUP flag affects the
137
 
database, including all threads of control accessing the database.
138
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_DUP
139
 
flag
140
 
must be the same as the existing database or an error
141
 
will be returned.
142
 
<p><dt><a name="DB_DUPSORT">DB_DUPSORT</a><dd>Permit duplicate data items in the tree; that is, insertion when the
143
 
key of the key/data pair being inserted already exists in the tree will
144
 
be successful.  The ordering of duplicates in the tree is determined by
145
 
the duplicate comparison function.
146
 
If the application does not specify a comparison function using the
147
 
<a href="../api_cxx/db_set_dup_compare.html">Db::set_dup_compare</a> method, a default lexical comparison will be
148
 
used.
149
 
It is an error to specify both DB_DUPSORT and DB_RECNUM.
150
 
<p>Calling Db::set_flags with the DB_DUPSORT flag affects the
151
 
database, including all threads of control accessing the database.
152
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_DUPSORT
153
 
flag
154
 
must be the same as the existing database or an error
155
 
will be returned.
156
 
</dl>
157
 
<h3>Queue</h3>
158
 
<p>There are no additional flags that may be specified for the Queue access
159
 
method.
160
 
<h3>Recno</h3>
161
 
<p>The following flags may be specified for the Recno access method:
162
 
<p><dl compact>
163
 
<a name="10"><!--meow--></a>
164
 
<p><dt><a name="DB_RENUMBER">DB_RENUMBER</a><dd>Specifying the DB_RENUMBER flag causes the logical record
165
 
numbers to be mutable, and change as records are added to and deleted
166
 
from the database.  For example, the deletion of record number 4 causes
167
 
records numbered 5 and greater to be renumbered downward by one.  If a
168
 
cursor was positioned to record number 4 before the deletion, it will
169
 
refer to the new record number 4, if any such record exists, after the
170
 
deletion.  If a cursor was positioned after record number 4 before the
171
 
deletion, it will be shifted downward one logical record, continuing to
172
 
refer to the same record as it did before.
173
 
<p>Using the <a href="../api_cxx/db_put.html">Db::put</a> or <a href="../api_cxx/dbc_put.html">Dbc::put</a> interfaces to create new
174
 
records will cause the creation of multiple records if the record number
175
 
is more than one greater than the largest record currently in the
176
 
database.  For example, creating record 28, when record 25 was previously
177
 
the last record in the database, will create records 26 and 27 as well as
178
 
28.  Attempts to retrieve records that were created in this manner will
179
 
result in an error return of <a href="../ref/program/errorret.html#DB_KEYEMPTY">DB_KEYEMPTY</a>.
180
 
<p>If a created record is not at the end of the database, all records
181
 
following the new record will be automatically renumbered upward by one.
182
 
For example, the creation of a new record numbered 8 causes records
183
 
numbered 8 and greater to be renumbered upward by one.  If a cursor was
184
 
positioned to record number 8 or greater before the insertion, it will be
185
 
shifted upward one logical record, continuing to refer to the same record
186
 
as it did before.
187
 
<p>For these reasons, concurrent access to a Recno database with the
188
 
DB_RENUMBER flag specified may be largely meaningless, although
189
 
it is supported.
190
 
<p>Calling Db::set_flags with the DB_RENUMBER flag affects the
191
 
database, including all threads of control accessing the database.
192
 
<p>If the database already exists when <a href="../api_cxx/db_open.html">Db::open</a> is called, the DB_RENUMBER
193
 
flag
194
 
must be the same as the existing database or an error
195
 
will be returned.
196
 
<a name="11"><!--meow--></a>
197
 
<p><dt><a name="DB_SNAPSHOT">DB_SNAPSHOT</a><dd>This flag specifies that any specified <b>re_source</b> file be read
198
 
in its entirety when <a href="../api_cxx/db_open.html">Db::open</a> is called.  If this flag is not
199
 
specified, the <b>re_source</b> file may be read lazily.
200
 
<p>Calling Db::set_flags with the DB_SNAPSHOT flag only affects the
201
 
specified <a href="../api_cxx/db_class.html">Db</a> handle (and any other Berkeley DB handles opened within
202
 
the scope of that handle).
203
 
</dl>
204
 
<p>The Db::set_flags interface may not be called after the <a href="../api_cxx/db_open.html">Db::open</a>
205
 
interface is called.
206
 
<p>The Db::set_flags method either returns a non-zero error value or throws an exception that
207
 
encapsulates a non-zero error value on failure, and returns 0 on success.
208
 
<h1>Errors</h1>
209
 
<p>The Db::set_flags method may fail and throw an exception or return a non-zero error for the following conditions:
210
 
<p><dl compact>
211
 
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
212
 
</dl>
213
 
<p>The <a href="../api_cxx/db_set_bt_compare.html">Db::set_bt_compare</a> method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods.
214
 
If a catastrophic error has occurred, the <a href="../api_cxx/db_set_bt_compare.html">Db::set_bt_compare</a> method may fail and
215
 
either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a
216
 
<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>,
217
 
in which case all subsequent Berkeley DB calls will fail in the same way.
218
 
<h1>Class</h1>
219
 
<a href="../api_cxx/db_class.html">Db</a>
220
 
<h1>See Also</h1>
221
 
<a href="../api_cxx/db_list.html">Databases and Related Methods</a>
222
 
</tt>
223
 
<table width="100%"><tr><td><br></td><td align=right>
224
 
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
225
 
</td></tr></table>
226
 
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
227
 
</body>
228
 
</html>