| java.lang.Object com.sleepycat.collections.DataCursor
DataCursor | final class DataCursor implements Cloneable(Code) | | Represents a Berkeley DB cursor and adds support for indices, bindings and
key ranges.
This class operates on a view and takes care of reading and updating
indices, calling bindings, constraining access to a key range, etc.
author: Mark Hayes |
Field Summary | |
final static int | REPOS_EOF Repositioned failed, no records on or after the key/data pair given. | final static int | REPOS_EXACT Repositioned exactly to the key/data pair given. | final static int | REPOS_NEXT Repositioned on a record following the key/data pair given. |
Constructor Summary | |
| DataCursor(DataView view, boolean writeAllowed) Creates a cursor for a given view. | | DataCursor(DataView view, boolean writeAllowed, CursorConfig config) Creates a cursor for a given view. | | DataCursor(DataView view, boolean writeAllowed, Object singleKey) Creates a cursor for a given view and single key range. | | DataCursor(DataView view, boolean writeAllowed, Object beginKey, boolean beginInclusive, Object endKey, boolean endInclusive) Creates a cursor for a given view and key range. | | DataCursor(DataView view, DataCursor[] indexCursors, JoinConfig joinConfig, boolean closeIndexCursors) Creates a join cursor. |
Method Summary | |
DataCursor | cloneCursor() Clones a cursor preserving the current position. | void | close() Closes the associated cursor. | int | count() Calls Cursor.count(), no join cursor allowed. | OperationStatus | delete() Perform an arbitrary database 'delete' operation. | OperationStatus | findBoth(Object key, Object value, boolean lockForWrite) Find the given key and value using getSearchBoth if possible or a
sequential scan otherwise, no join cursor allowed. | OperationStatus | findValue(Object value, boolean findFirst) Find the given value using getSearchBoth if possible or a sequential
scan otherwise, no join cursor allowed. | OperationStatus | getCurrent(boolean lockForWrite) Binding version of Cursor.getCurrent(), no join cursor allowed. | Object | getCurrentKey() Returns the key object for the last record read. | int | getCurrentRecordNumber() Returns the record number for the last record read. | Object | getCurrentValue() Returns the value object for the last record read. | RangeCursor | getCursor() Returns the internal range cursor. | OperationStatus | getFirst(boolean lockForWrite) Binding version of Cursor.getFirst(), join cursor is allowed. | DatabaseEntry | getKeyThang() Returns the internal key entry. | OperationStatus | getLast(boolean lockForWrite) Binding version of Cursor.getLast(), no join cursor allowed. | LockMode | getLockMode(boolean lockForWrite) Returns the lock mode to use for a getXxx() operation. | OperationStatus | getNext(boolean lockForWrite) Binding version of Cursor.getNext(), join cursor is allowed. | OperationStatus | getNextDup(boolean lockForWrite) Binding version of Cursor.getNextDup(), no join cursor allowed. | OperationStatus | getNextNoDup(boolean lockForWrite) Binding version of Cursor.getNext(), join cursor is allowed. | OperationStatus | getPrev(boolean lockForWrite) Binding version of Cursor.getPrev(), no join cursor allowed. | OperationStatus | getPrevDup(boolean lockForWrite) Binding version of Cursor.getPrevDup(), no join cursor allowed. | OperationStatus | getPrevNoDup(boolean lockForWrite) Binding version of Cursor.getPrevNoDup(), no join cursor allowed. | DatabaseEntry | getPrimaryKeyThang() Returns the internal primary key entry, which is the same object as the
key entry if the cursor is not for a secondary database. | KeyRange | getRange() Returns the range for this cursor. | OperationStatus | getSearchKey(Object key, Object value, boolean lockForWrite) Binding version of Cursor.getSearchKey(), no join cursor allowed. | OperationStatus | getSearchKeyRange(Object key, Object value, boolean lockForWrite) Binding version of Cursor.getSearchKeyRange(), no join cursor allowed. | DatabaseEntry | getValueThang() Returns the internal value entry. | DataView | getView() Returns the view for this cursor. | boolean | hasRecNumAccess() Returns whether record number access is allowed. | boolean | isWriteAllowed() Returns whether write is allowed for this cursor, as specified to the
constructor. | OperationStatus | put(Object key, Object value, Object[] oldValue, boolean useCurrentKey) Binding version of Cursor.put(), optionally returning the old value and
optionally using the current key instead of the key parameter. | OperationStatus | putAfter(Object value) Binding version of Cursor.putAfter(). | OperationStatus | putBefore(Object value) Binding version of Cursor.putBefore(). | OperationStatus | putCurrent(Object value) Binding version of Cursor.putCurrent(). | OperationStatus | putNoDupData(Object key, Object value, Object[] oldValue, boolean useCurrentKey) Binding version of Cursor.putNoDupData(), optionally returning the old
value and optionally using the current key instead of the key parameter. | OperationStatus | putNoOverwrite(Object key, Object value, boolean useCurrentKey) Binding version of Cursor.putNoOverwrite(), optionally using the current
key instead of the key parameter. | boolean | repositionExact(byte[] keyBytes, byte[] priKeyBytes, byte[] valueBytes, boolean lockForWrite) Repositions to a given raw key/data pair.
throws: IllegalStateException - when the database has unordered keys orunordered duplicates. | int | repositionRange(byte[] keyBytes, byte[] priKeyBytes, byte[] valueBytes, boolean lockForWrite) Repositions to a given raw key/data pair, or just past it if that record
has been deleted. | void | useRangeKey() Sets the key entry to the begin key of a single key range, so the next
time a putXxx() method is called that key will be used. |
REPOS_EOF | final static int REPOS_EOF(Code) | | Repositioned failed, no records on or after the key/data pair given.
|
REPOS_EXACT | final static int REPOS_EXACT(Code) | | Repositioned exactly to the key/data pair given.
|
REPOS_NEXT | final static int REPOS_NEXT(Code) | | Repositioned on a record following the key/data pair given.
|
DataCursor | DataCursor(DataView view, boolean writeAllowed, Object beginKey, boolean beginInclusive, Object endKey, boolean endInclusive) throws DatabaseException(Code) | | Creates a cursor for a given view and key range.
Used by unit tests.
|
getCurrentRecordNumber | int getCurrentRecordNumber() throws DatabaseException(Code) | | Returns the record number for the last record read.
|
getLockMode | LockMode getLockMode(boolean lockForWrite)(Code) | | Returns the lock mode to use for a getXxx() operation.
|
getPrimaryKeyThang | DatabaseEntry getPrimaryKeyThang()(Code) | | Returns the internal primary key entry, which is the same object as the
key entry if the cursor is not for a secondary database.
|
getSearchKey | OperationStatus getSearchKey(Object key, Object value, boolean lockForWrite) throws DatabaseException(Code) | | Binding version of Cursor.getSearchKey(), no join cursor allowed.
Searches by record number in a BTREE-RECNO db with RECNO access.
|
hasRecNumAccess | boolean hasRecNumAccess()(Code) | | Returns whether record number access is allowed.
|
isWriteAllowed | boolean isWriteAllowed()(Code) | | Returns whether write is allowed for this cursor, as specified to the
constructor.
|
putNoDupData | OperationStatus putNoDupData(Object key, Object value, Object[] oldValue, boolean useCurrentKey) throws DatabaseException(Code) | | Binding version of Cursor.putNoDupData(), optionally returning the old
value and optionally using the current key instead of the key parameter.
|
repositionExact | boolean repositionExact(byte[] keyBytes, byte[] priKeyBytes, byte[] valueBytes, boolean lockForWrite) throws DatabaseException(Code) | | Repositions to a given raw key/data pair.
throws: IllegalStateException - when the database has unordered keys orunordered duplicates. whether the search succeeded. |
repositionRange | int repositionRange(byte[] keyBytes, byte[] priKeyBytes, byte[] valueBytes, boolean lockForWrite) throws DatabaseException(Code) | | Repositions to a given raw key/data pair, or just past it if that record
has been deleted.
REPOS_EXACT, REPOS_NEXT or REPOS_EOF. |
useRangeKey | void useRangeKey()(Code) | | Sets the key entry to the begin key of a single key range, so the next
time a putXxx() method is called that key will be used.
|
|
|