.I:Berkeley DB Reference Guide: Access Methods[P4

Berkeley DB Reference Guide: Access Methods



2

Sorting duplicate data items



BBoth the Btree and Hash access methods support duplicates, i.e., aAkey item can have more than one data item associated with it. ToAcreate a database that can support duplicates, you should specify[the DB_DUP flag in the DB_INFO structure.

BIt is also possible to maintain duplicate records in sorted order.BThis will minimize the effort needed to search them and to performDlogical joins using them. To create a database where the duplicatesoare sorted, you should specify the DB_DUPSORT flag in theDB_INFO structure.

DThe sort order for duplicates in the underlying database can also bebspecified as part of the db_open call to open the database,6specifically by setting the dup_compare element of themDB_INFO structure. If the DB_DUPSORT flag is specifiedFand no comparison routine is specified, duplicates are maintained in adefault lexical order.

=For information on how searching and insertion behaves in the^presence of duplicates (sorted or not), see the DB->getDB->put, DBcursor->c_get and DBcursor->c_put functions.

KAHÿÿ