Logo Search packages:      
Sourcecode: db version File versions

OperationStatus com::sleepycat::collections::DataCursor::putCurrent ( Object  value  )  throws DatabaseException [inline, package]

Binding version of Cursor.putCurrent().

Definition at line 700 of file DataCursor.java.

References checkWriteAllowed(), com::sleepycat::collections::DataView::dupsOrdered, com::sleepycat::util::keyrange::RangeCursor::getCurrent(), com::sleepycat::collections::DataView::ordered, com::sleepycat::util::keyrange::RangeCursor::putCurrent(), and com::sleepycat::collections::DataView::useValue().

Referenced by com::sleepycat::collections::StoredIterator::set().

                                 {

        checkWriteAllowed(false);
        view.useValue(value, valueThang, keyThang);
        
        /*
         * Workaround for a DB core problem: With HASH type a put() with
         * different data is allowed.
         */
        boolean hashWorkaround = (view.dupsOrdered && !view.ordered);
        if (hashWorkaround) {
            if (otherThang == null) {
                otherThang = new DatabaseEntry();
            }
            cursor.getCurrent(keyThang, primaryKeyThang, otherThang,
                              LockMode.DEFAULT);
            if (KeyRange.equalBytes(valueThang, otherThang)) {
                return OperationStatus.SUCCESS;
            } else {
                throw new IllegalArgumentException(
                  "Current data differs from put data with sorted duplicates");
            }
        }

        return cursor.putCurrent(valueThang);
    }


Generated by  Doxygen 1.6.0   Back to index