0I-Berkeley DB: DbInfo::set_flags[P

DbInfo::set_flags





#include <db_cxx.h>

"void DbInfo::set_flags(u_int32_t);





Description



LThe following additional flags may be specified for the Btree access method:

X

DB_DUP
Permit duplicate data items in the tree, i.e. insertion when the key ofCthe key/data pair being inserted already exists in the tree will beHsuccessful. The ordering of duplicates in the tree is determined by theHorder of insertion, unless the ordering is otherwise specified by use of,a cursor or a duplicate comparison function.4It is an error to specify both DB_DUP and DB_RECNUM.]

DB_DUPSORT
Sort duplicates within a set of data items. If the application does notwspecify a comparison function using the DbInfo::set_compare method,+a default, lexical comparison will be used.

GSpecifying that duplicates are to be sorted changes the behavior of the‰Db::put operation as well as the Dbc::put operation whenÇthe DB_KEYFIRST, DB_KEYLAST and DB_CURRENTflags are specified.

DB_RECNUM
3Support retrieval from btrees using record numbers.fFor more information, see the DB_GET_RECNO flag to the Db::get>and Dbc::get methods.

BLogical record numbers in btrees are mutable in the face of recordinsertion or deletion.CSee the DB_RENUMBER flag in the Recno access method information forfurther discussion.

FMaintaining record counts within a btree introduces a serious point ofIcontention, namely the page locations where the record counts are stored.FIn addition, the entire tree must be locked during both insertions andFdeletions, effectively single-threading the tree for those operations.FSpecifying DB_RECNUM can result in serious performance degradation for some applications and data sets.

4It is an error to specify both DB_DUP and DB_RECNUM.



KThe following additional flags may be specified for the Hash access method:

X

DB_DUP
Permit duplicate data items in the tree, i.e. insertion when the key ofCthe key/data pair being inserted already exists in the tree will beHsuccessful. The ordering of duplicates in the tree is determined by theHorder of insertion, unless the ordering is otherwise specified by use of,a cursor or a duplicate comparison function.]

DB_DUPSORT
Sort duplicates within a set of data items. If the application does notwspecify a comparison function using the DbInfo::set_compare method,+a default, lexical comparison will be used.

GSpecifying that duplicates are to be sorted changes the behavior of the‰Db::put operation as well as the Dbc::put operation whenÇthe DB_KEYFIRST, DB_KEYLAST and DB_CURRENTflags are specified.



LThe following additional flags may be specified for the Recno access method:



DB_DELIMITER
'The re_delim value has been set.

DB_FIXEDLEN
1The records are fixed-length, not byte delimited.;The re_len value specifies the length of the record,9and the re_pad value is used as the pad character.

BAny records added to the database that are less than re_len$bytes long are automatically padded.EAny attempt to insert records into the database that are greater thanDre_len bytes long will cause the call to fail immediately andreturn an error.

DB_PAD
%The re_pad field has been set.

DB_RENUMBER
GSpecifying the DB_RENUMBER flag causes the logical record numbers to beJmutable, and change as records are added to and deleted from the database.FFor example, the deletion of record number 4 causes records numbered 5+and greater to be renumbered downward by 1.BIf a cursor was positioned to record number 4 before the deletion,Eit will reference the new record number 4, if any such record exists,after the deletion.EIf a cursor was positioned after record number 4 before the deletion,-it will be shifted downward 1 logical record,9continuing to reference the same record as it did before.

ƒUsing the Db::put or Dbc::put interfaces to createEnew records will cause the creation of multiple records if the recordHnumber is more than one greater than the largest record currently in the database.GFor example, creating record 28, when record 25 was previously the lastDrecord in the database, will create records 26 and 27 as well as 28.IAttempts to retrieve records that were created in this manner will result"in an error return of DB_KEYEMPTY.

LIf a created record is not at the end of the database, all records following<the new record will be automatically renumbered upward by 1.CFor example, the creation of a new record numbered 8 causes records4numbered 8 and greater to be renumbered upward by 1.NIf a cursor was positioned to record number 8 or greater before the insertion,+it will be shifted upward 1 logical record,9continuing to reference the same record as it did before.

For these reasons,Iconcurrent access to a recno database with the DB_RENUMBER flag specified5may be largely meaningless, although it is supported.

DB_SNAPSHOT
KThis flag specifies that any specified re_source file be read in itsJentirety when Db::open is called.LIf this flag is not specified, the re_source file may be read lazily.




Class

4DbInfo



See Also

NDbInfo::set_bt_compare,LDbInfo::set_bt_maxkey,LDbInfo::set_bt_minkey,LDbInfo::set_bt_prefix,LDbInfo::set_cachesize,HDbInfo::set_compare,DbInfo::set_flags,LDbInfo::set_h_ffactor,FDbInfo::set_h_hash,HDbInfo::set_h_nelem,FDbInfo::set_lorder,FDbInfo::set_malloc,JDbInfo::set_pagesize,JDbInfo::set_re_delim,FDbInfo::set_re_len,EDbInfo::set_re_padandLDbInfo::set_re_source.
)ÿÿt_flags.so 10.9 (Sleepycat) 10/29/98">I-Berkeley DB: DbInfo::set_flags[P

DbInfo