Logo Search packages:      
Sourcecode: db version File versions

boolean com::sleepycat::collections::DataView::useKey ( Object  key,
Object  value,
DatabaseEntry  keyThang,
KeyRange  checkRange 
) throws DatabaseException [inline, package]

Populates the key entry and returns whether the key is within range.

Definition at line 483 of file DataView.java.

References isSecondary(), com::sleepycat::bind::EntityBinding::objectToData(), com::sleepycat::bind::EntryBinding::objectToEntry(), and com::sleepycat::bind::EntityBinding::objectToKey().

Referenced by com::sleepycat::collections::DataCursor::findBoth(), com::sleepycat::collections::DataCursor::getSearchKey(), com::sleepycat::collections::DataCursor::getSearchKeyRange(), com::sleepycat::collections::DataCursor::initForPut(), and makeRangeKey().

                                 {

        if (key != null) {
            if (keyBinding == null) {
                throw new IllegalArgumentException(
                    "non-null key with null key binding");
            }
            keyBinding.objectToEntry(key, keyThang);
        } else {
            if (value == null) {
                throw new IllegalArgumentException(
                    "null key and null value");
            }
            if (entityBinding == null) {
                throw new IllegalStateException(
                    "EntityBinding required to derive key from value");
            }
            if (!dupsView && isSecondary()) {
                DatabaseEntry primaryKeyThang = new DatabaseEntry();
                entityBinding.objectToKey(value, primaryKeyThang);
                DatabaseEntry valueThang = new DatabaseEntry();
                entityBinding.objectToData(value, valueThang);
                secKeyCreator.createSecondaryKey(secDb, primaryKeyThang,
                                                 valueThang, keyThang);
            } else {
                entityBinding.objectToKey(value, keyThang);
            }
        }
        if (recNumAccess && DbCompat.getRecordNumber(keyThang) <= 0) {
            return false;
        }
        if (checkRange != null && !checkRange.check(keyThang)) {
            return false;
        }
        return true;
    }


Generated by  Doxygen 1.6.0   Back to index