|
Berkeley DB version 4.2.52 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sleepycat.bdb.DataCursor
(internal) Represents a Berkeley DB cursor and adds support for indices, bindings and key ranges.
NOTE: This classes is internal and may be changed incompatibly or deleted in the future. It is public only so it may be used by subpackages.
This class operates on a view and takes care of reading and updating indices, calling bindings, constraining access to a key range, etc.
Constructor Summary | |
DataCursor(DataCursor other)
Clones a cursor preserving the current position. |
|
DataCursor(DataView view,
boolean writeAllowed)
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. |
Method Summary | |
void |
close()
Closes a cursor. |
int |
count()
Return the number of duplicates for the current key. |
int |
delete()
Perform an arbitrary database 'delete' operation. |
int |
find(Object value,
boolean findFirst)
Find the given value, using DB_GET_BOTH if possible, or a sequential search otherwise. |
int |
get(Object key,
Object value,
int flag,
boolean lockForWrite)
Perform a database 'get' using the given key and value. |
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. |
DataView |
getView()
Returns the view for this cursor, as specified to the constructor. |
boolean |
hasRecNumAccess()
Returns whether record number access is allowed. |
boolean |
isWriteAllowed()
Returns whether write is allowed for this cursor, as specified to the constructor. |
int |
put(Object key,
Object value,
int flag,
Object[] oldValue)
Perform an arbitrary database 'put' operation, optionally returning the previous value. |
int |
put(Object key,
Object value,
int flag,
Object[] oldValue,
boolean useCurrentKey)
Perform an arbitrary database 'put' operation, optionally using the current key instead of the key parameter. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataCursor(DataView view, boolean writeAllowed) throws DbException, IOException
view
- the database view traversed by the cursor.writeAllowed
- whether the cursor can be used for writing.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public DataCursor(DataView view, boolean writeAllowed, Object singleKey) throws DbException, IOException
view
- the database view traversed by the cursor.writeAllowed
- whether the cursor can be used for writing.singleKey
- the single key value.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public DataCursor(DataView view, boolean writeAllowed, Object beginKey, boolean beginInclusive, Object endKey, boolean endInclusive) throws DbException, IOException
view
- the database view traversed by the cursor.writeAllowed
- whether the cursor can be used for writing.beginKey
- the lower bound.beginInclusive
- whether the lower bound is inclusive.endKey
- the upper bound.endInclusive
- whether the upper bound is inclusive.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public DataCursor(DataCursor other) throws DbException, IOException
other
- the cursor to clone.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.Method Detail |
public void close() throws DbException, IOException
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public DataView getView()
public boolean isWriteAllowed()
public Object getCurrentKey() throws DbException, IOException
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public Object getCurrentValue() throws DbException, IOException
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public boolean hasRecNumAccess()
public int getCurrentRecordNumber() throws DbException, IOException
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public int get(Object key, Object value, int flag, boolean lockForWrite) throws DbException, IOException
key
- the key or null if none is required by the flag.value
- the value or null if none is required by the flag.flag
- a single flag value appropriate for cursor get.lockForWrite
- whether to set the RMW flag.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public int find(Object value, boolean findFirst) throws DbException, IOException
value
- the value to search for among duplicates at the current
position.findFirst
- whether to find the first or last value.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public int count() throws DbException, IOException
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public int put(Object key, Object value, int flag, Object[] oldValue) throws DbException, IOException
key
- the key to put.value
- the value to put.flag
- a single flag value appropriate for cursor put.oldValue
- holds the old value, or null if the old value should
not be returned.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public int put(Object key, Object value, int flag, Object[] oldValue, boolean useCurrentKey) throws DbException, IOException
key
- the key to put.value
- the value to put.flag
- a single flag value appropriate for cursor put.oldValue
- holds the old value, or null if the old value should
not be returned.useCurrentKey
- is true to use the current key rather than the
key parameter.
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.public int delete() throws DbException, IOException
DbException
- if a database problem occurs.
IOException
- if an IO problem occurs.
|
Berkeley DB version 4.2.52 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |