Logo Search packages:      
Sourcecode: db4.2 version File versions  Download package

void com::sleepycat::db::Db::keyRange ( DbTxn  txnid,
Dbt  key,
DbKeyRange  key_range,
int  flags 
) throws DbException [inline]

The Db.keyRange method returns an estimate of the proportion of keys that are less than, equal to, and greater than the specified key. The underlying database must be of type Btree.

The Db.keyRange method fills in a DbKeyRange object. The following data fields are available from the DbKeyRange object: Values are in the range of 0 to 1; for example, if the field less is 0.05, 5% of the keys in the database are less than the key parameter. The value for equal will be zero if there is no matching key, and will be non-zero otherwise.

Parameters:
key The key Dbt operated on.
key_range The estimates are returned in the key_range parameter, which contains three elements of type double: less , equal , and greater . Values are in the range of 0 to 1; for example, if the field less is 0.05, 5% of the keys in the database are less than the key parameter. The value for equal will be zero if there is no matching key, and will be non-zero otherwise.
txnid If the operation is to be transaction-protected, the txnid parameter is a transaction handle returned from DbEnv.txnBegin; otherwise, null. The Db.keyRange method does not retain the locks it acquires for the life of the transaction, so estimates may not be repeatable.
flags currently unused, and must be set to 0.
Exceptions:
DbException The Db.keyRange method may fail and throw DbException, encapsulating one of the following non-zero errors:
DbDeadlockException If a transactional database environment operation was selected to resolve a deadlock, the Db.keyRange method will fail and throw a DbDeadlockException exception.
DbLockNotGrantedException If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the Db.keyRange method will fail and throw a DbLockNotGrantedException exception.
IllegalArgumentException The Db.keyRange method will fail and throw a IllegalArgumentException exception if the underlying database was not of type Btree; or if an invalid flag value or parameter was specified.

Definition at line 4493 of file Db.java.

                                                                                                   {
        db_javaJNI.Db_key_range(swigCPtr, DbTxn.getCPtr(txnid), key, key_range, flags);
    }


Generated by  Doxygen 1.6.0   Back to index