|
Berkeley DB version 4.3.29 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.db.Cursor
A database cursor. Cursors are used for operating on collections of records, for iterating over a database, and for saving handles to individual records, so that they can be modified after they have been read.
Cursors may be used by multiple threads, but only serially. That is, the application must serialize access to the handle.
If the cursor is to be used to perform operations on behalf of a transaction, the cursor must be opened and closed within the context of that single transaction.
Once the cursor close method has been called, the handle may not be accessed again, regardless of the close method's success or failure.
To obtain a cursor with default attributes:
To customize the attributes of a cursor, use a CursorConfig object.Cursor cursor = myDatabase.openCursor(txn, null);
CursorConfig config = new CursorConfig(); config.setDirtyRead(true); Cursor cursor = myDatabase.openCursor(txn, config);
Modifications to the database during a sequential scan will be reflected in the scan; that is, records inserted behind a cursor will not be returned while records inserted in front of a cursor will be returned. In Queue and Recno databases, missing entries (that is, entries that were never explicitly created or that were created and then deleted) will be ignored during a sequential scan.
Method Summary | |
void |
close()
Discard the cursor. |
int |
count()
Return a count of the number of data items for the key to which the cursor refers. |
OperationStatus |
delete()
Delete the key/data pair to which the cursor refers. |
Cursor |
dup(boolean samePosition)
Return a new cursor with the same transaction and locker ID as the original cursor. |
CursorConfig |
getConfig()
Return this cursor's configuration. |
OperationStatus |
getCurrent(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Returns the key/data pair to which the cursor refers. |
Database |
getDatabase()
Return the Database handle associated with this Cursor. |
OperationStatus |
getFirst(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the first key/data pair of the database, and return that pair. |
OperationStatus |
getLast(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the last key/data pair of the database, and return that pair. |
OperationStatus |
getNext(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the next key/data pair and return that pair. |
OperationStatus |
getNextDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
If the next key/data pair of the database is a duplicate data record for the current key/data pair, move the cursor to the next key/data pair of the database and return that pair. |
OperationStatus |
getNextNoDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the next non-duplicate key/data pair and return that pair. |
OperationStatus |
getPrev(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the previous key/data pair and return that pair. |
OperationStatus |
getPrevDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
If the previous key/data pair of the database is a duplicate data record for the current key/data pair, move the cursor to the previous key/data pair of the database and return that pair. |
OperationStatus |
getPrevNoDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the previous non-duplicate key/data pair and return that pair. |
OperationStatus |
getRecordNumber(DatabaseEntry data,
LockMode lockMode)
Return the record number associated with the cursor. |
OperationStatus |
getSearchBoth(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the specified key/data pair, where both the key and data items must match. |
OperationStatus |
getSearchBothRange(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the specified key and closest matching data item of the database. |
OperationStatus |
getSearchKey(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the given key of the database, and return the datum associated with the given key. |
OperationStatus |
getSearchKeyRange(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the closest matching key of the database, and return the data item associated with the matching key. |
OperationStatus |
getSearchRecordNumber(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Move the cursor to the specific numbered record of the database, and return the associated key/data pair. |
OperationStatus |
put(DatabaseEntry key,
DatabaseEntry data)
Store a key/data pair into the database. |
OperationStatus |
putAfter(DatabaseEntry key,
DatabaseEntry data)
Store a key/data pair into the database. |
OperationStatus |
putBefore(DatabaseEntry key,
DatabaseEntry data)
Store a key/data pair into the database. |
OperationStatus |
putCurrent(DatabaseEntry data)
Store a key/data pair into the database. |
OperationStatus |
putKeyFirst(DatabaseEntry key,
DatabaseEntry data)
Store a key/data pair into the database. |
OperationStatus |
putKeyLast(DatabaseEntry key,
DatabaseEntry data)
Store a key/data pair into the database. |
OperationStatus |
putNoDupData(DatabaseEntry key,
DatabaseEntry data)
Store a key/data pair into the database. |
OperationStatus |
putNoOverwrite(DatabaseEntry key,
DatabaseEntry data)
Store a key/data pair into the database. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public Database getDatabase()
public CursorConfig getConfig()
This may differ from the configuration used to open this object if the cursor existed previously.
DatabaseException
- if a failure occurs.public void close() throws DatabaseException
This method may throw a DeadlockException, signaling the enclosing transaction should be aborted. If the application is already intending to abort the transaction, this error can be ignored, and the application should proceed.
The cursor handle may not be used again after this method has been called, regardless of the method's success or failure.
DatabaseException
- if a failure occurs.public int count() throws DatabaseException
DeadlockException
- if the operation was selected to resolve a
deadlock.
DatabaseException
- if a failure occurs.public Cursor dup(boolean samePosition) throws DatabaseException
This is useful when an application is using locking and requires two or more cursors in the same thread of control.
samePosition
- If true, the newly created cursor is initialized to refer to the
same position in the database as the original cursor (if any) and
hold the same locks (if any). If false, or the original cursor does
not hold a database position and locks, the returned cursor is
uninitialized and will behave like a newly created cursor.
DatabaseException
- if a failure occurs.public OperationStatus delete() throws DatabaseException
When called on a cursor opened on a database that has been made into a secondary index, this method the key/data pair from the primary database and all secondary indices.
The cursor position is unchanged after a delete, and subsequent calls to cursor functions expecting the cursor to refer to an existing key will fail.
DeadlockException
- if the operation was selected to resolve a
deadlock.
DatabaseException
- if a failure occurs.public OperationStatus put(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
If the put method succeeds, the cursor is always positioned to refer to the newly inserted item. If the put method fails for any reason, the state of the cursor will be unchanged.
If the key already appears in the database and duplicates are supported, the new data value is inserted at the correct sorted location. If the key already appears in the database and duplicates are not supported, the existing key/data pair will be replaced.
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus putNoOverwrite(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
If the putNoOverwrite method succeeds, the cursor is always positioned to refer to the newly inserted item. If the putNoOverwrite method fails for any reason, the state of the cursor will be unchanged.
If the key already appears in the database, putNoOverwrite will return
OperationStatus.KEYEXIST
.
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus putNoDupData(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
If the putNoDupData method succeeds, the cursor is always positioned to refer to the newly inserted item. If the putNoDupData method fails for any reason, the state of the cursor will be unchanged.
In the case of the Btree and Hash access methods, insert
the specified key/data pair into the database, unless a key/data pair
comparing equally to it already exists in the database. If a matching
key/data pair already exists in the database, OperationStatus.KEYEXIST
is returned.
This method may only be called if the underlying database has been configured to support sorted duplicate data items.
This method may not be called for the Queue or Recno access methods.
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus putCurrent(DatabaseEntry data) throws DatabaseException
If the putCurrent method succeeds, the cursor is always positioned to refer to the newly inserted item. If the putCurrent method fails for any reason, the state of the cursor will be unchanged.
Overwrite the data of the key/data pair to which the cursor refers with the specified data item. This method will fail and throw an exception if the cursor currently refers to an already-deleted key/data pair.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus putAfter(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
If the putAfter method succeeds, the cursor is always positioned to refer to the newly inserted item. If the putAfter method fails for any reason, the state of the cursor will be unchanged.
In the case of the Btree and Hash access methods, insert the data element as a duplicate element of the key to which the cursor refers. The new element appears immediately after the current cursor position. It is an error to call this method if the underlying Btree or Hash database does not support duplicate data items. The key parameter is ignored.
In the case of the Hash access method, the putAfter method will fail and throw an exception if the current cursor record has already been deleted.
In the case of the Recno access method, it is an error to call this method if the underlying Recno database was not configured to have mutable record numbers. A new key is created, all records after the inserted item are automatically renumbered, and the key of the new record is returned in the key parameter. The initial value of the key parameter is ignored.
The putAfter method may not be called for the Queue access method.
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus putBefore(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
If the putBefore method succeeds, the cursor is always positioned to refer to the newly inserted item. If the putBefore method fails for any reason, the state of the cursor will be unchanged.
In the case of the Btree and Hash access methods, insert the data element as a duplicate element of the key to which the cursor refers. The new element appears immediately before the current cursor position. It is an error to call this method if the underlying Btree or Hash database does not support duplicate data items. The key parameter is ignored.
In the case of the Hash access method, the putBefore method will fail and throw an exception if the current cursor record has already been deleted.
In the case of the Recno access method, it is an error to call this method if the underlying Recno database was not configured to have mutable record numbers. A new key is created, all records after the inserted item are automatically renumbered, and the key of the new record is returned in the key parameter. The initial value of the key parameter is ignored.
The putBefore method may not be called for the Queue access method.
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus putKeyFirst(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
If the putKeyFirst method succeeds, the cursor is always positioned to refer to the newly inserted item. If the putKeyFirst method fails for any reason, the state of the cursor will be unchanged.
In the case of the Btree and Hash access methods, insert the specified key/data pair into the database.
If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database and no duplicate sort function has been specified, the inserted data item is added as the first of the data items for that key.
The putKeyFirst method may not be called for the Queue or Recno access methods.
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus putKeyLast(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
If the putKeyLast method succeeds, the cursor is always positioned to refer to the newly inserted item. If the putKeyLast method fails for any reason, the state of the cursor will be unchanged.
In the case of the Btree and Hash access methods, insert the specified key/data pair into the database.
If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database and no duplicate sort function has been specified, the inserted data item is added as the last of the data items for that key.
The putKeyLast method may not be called for the Queue or Recno access methods.
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.public OperationStatus getCurrent(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.KEYEMPTY
if the key/pair at the cursor
position has been deleted; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getFirst(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getLast(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Its byte array does not need to be initialized by the
caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getNext(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If the cursor is not yet initialized, move the cursor to the first key/data pair of the database, and return that pair. Otherwise, the cursor is moved to the next key/data pair of the database, and that pair is returned. In the presence of duplicate key values, the value of the key may not change.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getNextDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getNextNoDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If the cursor is not yet initialized, move the cursor to the first key/data pair of the database, and return that pair. Otherwise, the cursor is moved to the next non-duplicate key of the database, and that key/data pair is returned.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getPrev(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If the cursor is not yet initialized, move the cursor to the last key/data pair of the database, and return that pair. Otherwise, the cursor is moved to the previous key/data pair of the database, and that pair is returned. In the presence of duplicate key values, the value of the key may not change.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Its byte array does not need to be initialized by the
caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getPrevDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Its byte array does not need to be initialized by the
caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getPrevNoDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If the cursor is not yet initialized, move the cursor to the last key/data pair of the database, and return that pair. Otherwise, the cursor is moved to the previous non-duplicate key of the database, and that key/data pair is returned.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Its byte array does not need to be initialized by the
caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getSearchKey(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
used as input. It must be initialized with a non-null byte array by the
caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getSearchKeyRange(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
The returned key/data pair is for the smallest key greater than or equal to the specified key (as determined by the key comparison function), permitting partial key matches and range searches.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
used as input and returned as output. It must be initialized with a non-null
byte array by the caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getSearchBoth(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
used as input. It must be initialized with a non-null byte array by the
caller.data
- the data
used as input. It must be initialized with a non-null byte array by the
caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getSearchBothRange(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
In the case of any database supporting sorted duplicate sets, the returned key/data pair is for the smallest data item greater than or equal to the specified data item (as determined by the duplicate comparison function), permitting partial matches and range searches in duplicate data sets.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
used as input and returned as output. It must be initialized with a non-null
byte array by the caller.data
- the data
used as input and returned as output. It must be initialized with a non-null
byte array by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getRecordNumber(DatabaseEntry data, LockMode lockMode) throws DatabaseException
For this method to be called, the underlying database must be of type Btree, and it must have been configured to support record numbers.
If this method fails for any reason, the position of the cursor will be unchanged.
data
- the data
returned as output. Its byte array does not need to be initialized by the
caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
public OperationStatus getSearchRecordNumber(DatabaseEntry key, DatabaseEntry data, LockMode lockMode) throws DatabaseException
The data field of the specified key must be a byte array containing a
record number, as described in DatabaseEntry
. This determines
the record to be retrieved.
For this method to be called, the underlying database must be of type Btree, and it must have been configured to support record numbers.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the key
returned as output. Its byte array does not need to be initialized by the
caller.data
- the data
returned as output. Multiple results can be retrieved by passing an object
that is a subclass of MultipleEntry
, otherwise its byte array does not
need to be initialized by the caller.lockMode
- the locking attributes; if null, default attributes are used.
OperationStatus.NOTFOUND
if no matching key/data pair is
found; otherwise, OperationStatus.SUCCESS
.
NullPointerException
- if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
DeadlockException
- if the operation was selected to resolve a
deadlock.
IllegalArgumentException
- if an invalid parameter was specified.
DatabaseException
- if a failure occurs.
|
Berkeley DB version 4.3.29 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |