1
<! "@(#)set_flags.so 10.9 (Sleepycat) 10/29/98">
2
<!Copyright 1997, 1998 by Sleepycat Software, Inc. All rights reserved.>
6
<title>Berkeley DB: DbInfo::set_flags</title>
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btr
9
ee,hash,hashing,transaction,transactions,locking,logging,access method,access me
12
<h1>DbInfo::set_flags</h1>
17
#include <db_cxx.h>
19
void DbInfo::set_flags(u_int32_t);
24
The following additional flags may be specified for the Btree access method:
27
<p><dt>DB_DUP<dd>Permit duplicate data items in the tree, i.e. insertion when the key of
28
the key/data pair being inserted already exists in the tree will be
29
successful. The ordering of duplicates in the tree is determined by the
30
order of insertion, unless the ordering is otherwise specified by use of
31
a cursor or a duplicate comparison function.
32
It is an error to specify both DB_DUP and DB_RECNUM.
34
<p><dt>DB_DUPSORT<dd>Sort duplicates within a set of data items. If the application does not
35
specify a comparison function using the <a href="../../api_cxx/DbInfo/set_compare.html">DbInfo::set_compare</a> method,
36
a default, lexical comparison will be used.
38
Specifying that duplicates are to be sorted changes the behavior of the
39
<a href="../../api_cxx/Db/put.html">Db::put</a> operation as well as the <a href="../../api_cxx/Dbc/put.html">Dbc::put</a> operation when
40
the <a href="../../api_cxx/Dbc/put.html#DB_KEYFIRST">DB_KEYFIRST</a>, <a href="../../api_cxx/Dbc/put.html#DB_KEYLAST">DB_KEYLAST</a> and <a href="../../api_cxx/Dbc/get.html#DB_CURRENT">DB_CURRENT</a>
44
Support retrieval from btrees using record numbers.
45
For more information, see the DB_GET_RECNO flag to the <a href="../../api_cxx/Db/get.html">Db::get</a>
46
and <a href="../../api_cxx/Dbc/get.html">Dbc::get</a> methods.
48
Logical record numbers in btrees are mutable in the face of record
49
insertion or deletion.
50
See the DB_RENUMBER flag in the Recno access method information for
53
Maintaining record counts within a btree introduces a serious point of
54
contention, namely the page locations where the record counts are stored.
55
In addition, the entire tree must be locked during both insertions and
56
deletions, effectively single-threading the tree for those operations.
57
Specifying DB_RECNUM can result in serious performance degradation for
58
some applications and data sets.
60
It is an error to specify both DB_DUP and DB_RECNUM.
63
The following additional flags may be specified for the Hash access method:
66
<p><dt>DB_DUP<dd>Permit duplicate data items in the tree, i.e. insertion when the key of
67
the key/data pair being inserted already exists in the tree will be
68
successful. The ordering of duplicates in the tree is determined by the
69
order of insertion, unless the ordering is otherwise specified by use of
70
a cursor or a duplicate comparison function.
72
<p><dt>DB_DUPSORT<dd>Sort duplicates within a set of data items. If the application does not
73
specify a comparison function using the <a href="../../api_cxx/DbInfo/set_compare.html">DbInfo::set_compare</a> method,
74
a default, lexical comparison will be used.
76
Specifying that duplicates are to be sorted changes the behavior of the
77
<a href="../../api_cxx/Db/put.html">Db::put</a> operation as well as the <a href="../../api_cxx/Dbc/put.html">Dbc::put</a> operation when
78
the <a href="../../api_cxx/Dbc/put.html#DB_KEYFIRST">DB_KEYFIRST</a>, <a href="../../api_cxx/Dbc/put.html#DB_KEYLAST">DB_KEYLAST</a> and <a href="../../api_cxx/Dbc/get.html#DB_CURRENT">DB_CURRENT</a>
82
The following additional flags may be specified for the Recno access method:
84
<p><dt>DB_DELIMITER<dd>
85
The <b>re_delim</b> value has been set.
86
<p><dt>DB_FIXEDLEN<dd>
87
The records are fixed-length, not byte delimited.
88
The <b>re_len</b> value specifies the length of the record,
89
and the <b>re_pad</b> value is used as the pad character.
91
Any records added to the database that are less than <b>re_len</b>
92
bytes long are automatically padded.
93
Any attempt to insert records into the database that are greater than
94
<b>re_len</b> bytes long will cause the call to fail immediately and
97
The <b>re_pad</b> field has been set.
98
<p><dt>DB_RENUMBER<dd>
99
Specifying the DB_RENUMBER flag causes the logical record numbers to be
100
mutable, and change as records are added to and deleted from the database.
101
For example, the deletion of record number 4 causes records numbered 5
102
and greater to be renumbered downward by 1.
103
If a cursor was positioned to record number 4 before the deletion,
104
it will reference the new record number 4, if any such record exists,
106
If a cursor was positioned after record number 4 before the deletion,
107
it will be shifted downward 1 logical record,
108
continuing to reference the same record as it did before.
110
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
111
new records will cause the creation of multiple records if the record
112
number is more than one greater than the largest record currently in the
114
For example, creating record 28, when record 25 was previously the last
115
record in the database, will create records 26 and 27 as well as 28.
116
Attempts to retrieve records that were created in this manner will result
117
in an error return of DB_KEYEMPTY.
119
If a created record is not at the end of the database, all records following
120
the new record will be automatically renumbered upward by 1.
121
For example, the creation of a new record numbered 8 causes records
122
numbered 8 and greater to be renumbered upward by 1.
123
If a cursor was positioned to record number 8 or greater before the insertion,
124
it will be shifted upward 1 logical record,
125
continuing to reference the same record as it did before.
128
concurrent access to a recno database with the DB_RENUMBER flag specified
129
may be largely meaningless, although it is supported.
130
<p><dt>DB_SNAPSHOT<dd>
131
This flag specifies that any specified <b>re_source</b> file be read in its
132
entirety when <a href="../../api_cxx/Db/open.html">Db::open</a> is called.
133
If this flag is not specified, the <b>re_source</b> file may be read lazily.
137
<a href="../../api_cxx/DbInfo/class.html">DbInfo</a>
140
<a href="../../api_cxx/DbInfo/set_bt_compare.html">DbInfo::set_bt_compare</a>,
141
<a href="../../api_cxx/DbInfo/set_bt_maxkey.html">DbInfo::set_bt_maxkey</a>,
142
<a href="../../api_cxx/DbInfo/set_bt_minkey.html">DbInfo::set_bt_minkey</a>,
143
<a href="../../api_cxx/DbInfo/set_bt_prefix.html">DbInfo::set_bt_prefix</a>,
144
<a href="../../api_cxx/DbInfo/set_cachesize.html">DbInfo::set_cachesize</a>,
145
<a href="../../api_cxx/DbInfo/set_compare.html">DbInfo::set_compare</a>,
147
<a href="../../api_cxx/DbInfo/set_h_ffactor.html">DbInfo::set_h_ffactor</a>,
148
<a href="../../api_cxx/DbInfo/set_h_hash.html">DbInfo::set_h_hash</a>,
149
<a href="../../api_cxx/DbInfo/set_h_nelem.html">DbInfo::set_h_nelem</a>,
150
<a href="../../api_cxx/DbInfo/set_lorder.html">DbInfo::set_lorder</a>,
151
<a href="../../api_cxx/DbInfo/set_malloc.html">DbInfo::set_malloc</a>,
152
<a href="../../api_cxx/DbInfo/set_pagesize.html">DbInfo::set_pagesize</a>,
153
<a href="../../api_cxx/DbInfo/set_re_delim.html">DbInfo::set_re_delim</a>,
154
<a href="../../api_cxx/DbInfo/set_re_len.html">DbInfo::set_re_len</a>,
155
<a href="../../api_cxx/DbInfo/set_re_pad.html">DbInfo::set_re_pad</a>
157
<a href="../../api_cxx/DbInfo/set_re_source.html">DbInfo::set_re_source</a>.