|
Berkeley DB Java Edition version 1.5.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sleepycat.je.Cursor | +--com.sleepycat.je.SecondaryCursor
A database cursor for a secondary database. Cursors are not thread safe and the application is responsible for coordinating any multithreaded access to a single cursor object.
Secondary cursors are returned by SecondaryDatabase.openCursor
and SecondaryDatabase.openSecondaryCursor
. The distinguishing characteristics
of a secondary cursor are:
put()
methods on a secondary cursor are
prohibited.delete()
method of a secondary cursor will delete the primary
record and as well as all its associated secondary records.get()
methods will return the data from the
associated primary database.get()
method signatures are provided to return
the primary key in an additional pKey
parameter.dup(boolean)
will return a SecondaryCursor
.dupSecondary(boolean)
method is provided to return a SecondaryCursor
that doesn't require casting.To obtain a secondary cursor with default attributes:
SecondaryCursor cursor = myDb.openSecondaryCursor(txn, null);To customize the attributes of a cursor, use a CursorConfig object.
CursorConfig config = new CursorConfig(); config.setDirtyRead(true); SecondaryCursor cursor = myDb.openSecondaryCursor(txn, config);
Method Summary | |
OperationStatus |
delete()
Delete the key/data pair to which the cursor refers from the primary database and all secondary indices. |
Cursor |
dup(boolean samePosition)
Returns a new SecondaryCursor for the same transaction as
the original cursor. |
SecondaryCursor |
dupSecondary(boolean samePosition)
Returns a new copy of the cursor as a SecondaryCursor . |
OperationStatus |
getCurrent(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Returns the key/data pair to which the cursor refers. |
OperationStatus |
getCurrent(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Returns the key/data pair to which the cursor refers. |
OperationStatus |
getFirst(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the first key/data pair of the database, and returns that pair. |
OperationStatus |
getFirst(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the first key/data pair of the database, and returns that pair. |
OperationStatus |
getLast(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the last key/data pair of the database, and returns that pair. |
OperationStatus |
getLast(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the last key/data pair of the database, and returns that pair. |
OperationStatus |
getNext(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the next key/data pair and returns that pair. |
OperationStatus |
getNext(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the next key/data pair and returns that pair. |
OperationStatus |
getNextDup(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
If the next key/data pair of the database is a duplicate data record for the current key/data pair, moves the cursor to the next key/data pair of the database and returns 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, moves the cursor to the next key/data pair of the database and returns that pair. |
OperationStatus |
getNextNoDup(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the next non-duplicate key/data pair and returns that pair. |
OperationStatus |
getNextNoDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the next non-duplicate key/data pair and returns that pair. |
OperationStatus |
getPrev(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the previous key/data pair and returns that pair. |
OperationStatus |
getPrev(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the previous key/data pair and returns that pair. |
OperationStatus |
getPrevDup(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
If the previous key/data pair of the database is a duplicate data record for the current key/data pair, moves the cursor to the previous key/data pair of the database and returns 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, moves the cursor to the previous key/data pair of the database and returns that pair. |
OperationStatus |
getPrevNoDup(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the previous non-duplicate key/data pair and returns that pair. |
OperationStatus |
getPrevNoDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the previous non-duplicate key/data pair and returns that pair. |
Database |
getPrimaryDatabase()
Returns the primary Database associated with this cursor. |
OperationStatus |
getSearchBoth(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the specified secondary and primary key, that is, both the primary and secondary key items must match. |
OperationStatus |
getSearchBoth(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
This operation is not allowed with this method signature. |
OperationStatus |
getSearchBothRange(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the specified secondary key and closest matching primary key of the database. |
OperationStatus |
getSearchBothRange(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
This operation is not allowed with this method signature. |
OperationStatus |
getSearchKey(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the given key of the database, and returns the datum associated with the given key. |
OperationStatus |
getSearchKey(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the given key of the database, and returns the datum associated with the given key. |
OperationStatus |
getSearchKeyRange(DatabaseEntry key,
DatabaseEntry pKey,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the closest matching key of the database, and returns the datum associated with the matching key. |
OperationStatus |
getSearchKeyRange(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the closest matching key of the database, and returns the datum associated with the matching key. |
OperationStatus |
put(DatabaseEntry key,
DatabaseEntry data)
This operation is not allowed on a secondary database. |
OperationStatus |
putCurrent(DatabaseEntry data)
This operation is not allowed on a secondary database. |
OperationStatus |
putNoDupData(DatabaseEntry key,
DatabaseEntry data)
This operation is not allowed on a secondary database. |
OperationStatus |
putNoOverwrite(DatabaseEntry key,
DatabaseEntry data)
This operation is not allowed on a secondary database. |
Methods inherited from class com.sleepycat.je.Cursor |
close, count, getConfig, getDatabase |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public Database getPrimaryDatabase()
Database
associated with this cursor.
Calling this method is the equivalent of the following expression:
((SecondaryDatabase) this.getDatabase()).getPrimaryDatabase()
Database
associated with this cursor.public Cursor dup(boolean samePosition) throws DatabaseException
SecondaryCursor
for the same transaction as
the original cursor.
dup
in class Cursor
samePosition
- If true, the newly created cursor is initialized to refer to the
same position in the database as the original cursor and hold the
same locks. If false, the created cursor is uninitialized and will
behave like a cursor newly created using openCursor
.
DatabaseException
- if a failure occurs.public SecondaryCursor dupSecondary(boolean samePosition) throws DatabaseException
SecondaryCursor
.
Calling this method is the equivalent of calling dup(boolean)
and
casting the result to SecondaryCursor
.
DatabaseException
dup(boolean)
public OperationStatus delete() throws DatabaseException
This method behaves as if Database.delete(com.sleepycat.je.Transaction, com.sleepycat.je.DatabaseEntry)
were called for the
primary database, using the primary key obtained via the secondary key
parameter.
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.
delete
in class Cursor
DatabaseException
- if a failure occurs.public OperationStatus put(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
UnsupportedOperationException
will always be thrown by this method.
The corresponding method on the primary database should be used instead.
put
in class Cursor
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DatabaseException
- if a failure occurs.public OperationStatus putNoOverwrite(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
UnsupportedOperationException
will always be thrown by this method.
The corresponding method on the primary database should be used instead.
putNoOverwrite
in class Cursor
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DatabaseException
- if a failure occurs.public OperationStatus putNoDupData(DatabaseEntry key, DatabaseEntry data) throws DatabaseException
UnsupportedOperationException
will always be thrown by this method.
The corresponding method on the primary database should be used instead.
putNoDupData
in class Cursor
key
- the key DatabaseEntry
operated on.
data
- the data DatabaseEntry
stored.
DatabaseException
- if a failure occurs.public OperationStatus putCurrent(DatabaseEntry data) throws DatabaseException
UnsupportedOperationException
will always be thrown by this method.
The corresponding method on the primary database should be used instead.
putCurrent
in class Cursor
data
- the data DatabaseEntry
stored.
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.
getCurrent
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
KEYEMPTY
if the key/pair at the cursor
position has been deleted; otherwise, 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 getCurrent(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
KEYEMPTY
if the key/pair at the cursor
position has been deleted; otherwise, 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.
getFirst
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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.
getLast
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
getNext
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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
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.
If this method fails for any reason, the position of the cursor will be unchanged.
getNextDup
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException
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.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
getNextNoDup
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
getPrev
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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
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.
If this method fails for any reason, the position of the cursor will be unchanged.
getPrevDup
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException
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.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
getPrevNoDup
in class Cursor
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, 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.
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.
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
returned as output. Its byte array does not need to be initialized by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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.
getSearchKey
in class Cursor
key
- the secondary key
used as input. It must be initialized with a non-null byte array by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
used as input. It must be initialized with a non-null byte array by the
caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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.
getSearchKeyRange
in class Cursor
key
- the secondary key
used as input and returned as output. It must be initialized with a non-null
byte array by the caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 pKey, 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 secondary key
used as input and returned as output. It must be initialized with a non-null
byte array by the caller.
pKey
- the primary key
returned as output. Its byte array does not need to be initialized by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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
UnsupportedOperationException
will always be thrown by this method.
The corresponding method with the pKey
parameter should be used
instead.
getSearchBoth
in class Cursor
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.
NOTFOUND
if no matching key/data pair is
found; otherwise, SUCCESS
.
DatabaseException
- if a failure occurs.
public OperationStatus getSearchBoth(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException
If this method fails for any reason, the position of the cursor will be unchanged.
key
- the secondary key
used as input. It must be initialized with a non-null byte array by the
caller.
pKey
- the primary key
used as input. It must be initialized with a non-null byte array by the
caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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
UnsupportedOperationException
will always be thrown by this method.
The corresponding method with the pKey
parameter should be used
instead.
getSearchBothRange
in class Cursor
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 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, SUCCESS
.
DatabaseException
- if a failure occurs.
public OperationStatus getSearchBothRange(DatabaseEntry key, DatabaseEntry pKey, 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 primary key greater than or equal to the specified primary key (as determined by the key 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 secondary key
used as input. It must be initialized with a non-null byte array by the
caller.
pKey
- the primary key
used as input and returned as output. It must be initialized with a non-null
byte array by the caller.
data
- the primary 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.
NOTFOUND
if no matching key/data pair is
found; otherwise, 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 Java Edition version 1.5.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |