Berkeley DB
version 4.2.52

com.sleepycat.db
Interface DbBtreeCompare


public interface DbBtreeCompare

An interface specifying a comparison function, which imposes a total ordering on the keys in a Btree database.


Method Summary
 int compare(Db db, Dbt dbt1, Dbt dbt2)
          The DbBtreeCompare interface is used by the Db.setBtreeCompare method.
 

Method Detail

compare

public int compare(Db db,
                   Dbt dbt1,
                   Dbt dbt2)
The DbBtreeCompare interface is used by the Db.setBtreeCompare method.

Parameters:
db - the enclosing database handle.
dbt1 - the Dbt representing the application supplied key.
dbt2 - the Dbt representing the current tree's key.
Returns:
The bt_compare_fcn function must return an integer value less than, equal to, or greater than zero if the first key parameter is considered to be respectively less than, equal to, or greater than the second key parameter. In addition, the comparison function must cause the keys in the database to be well-ordered. The comparison function must correctly handle any key values used by the application (possibly including zero-length keys). In addition, when Btree key prefix comparison is being performed (see Db.setBtreePrefix for more information), the comparison routine may be passed a prefix of any database key. The data and size fields of the Dbt are the only fields that may be used for the purposes of this comparison, and no particular alignment of the memory to which by the data field refers may be assumed.


Berkeley DB
version 4.2.52

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.