SecondaryCursor (Oracle - Berkeley DB Java API)
Keywords: com.sleepycat.db.SecondaryCursor class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.6.21
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.db
Class SecondaryCursor

    java.lang.Object
      com.sleepycat.db.Cursor
          com.sleepycat.db.SecondaryCursor

    public class SecondaryCursor

extends Cursor

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:

- Direct calls to `put()` methods on a secondary cursor are prohibited.
- The `Cursor.delete()` method of a secondary cursor will delete the primary record and as well as all its associated secondary records.
- Calls to all get methods will return the data from the associated primary database.
- Additional get method signatures are provided to return the primary key in an additional pKey parameter.
- Calls to `dup(boolean)` will return a `SecondaryCursor`.
- The `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
`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` | `getFirst(DatabaseEntry key, DatabaseEntry pKey, 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 pKey, 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 pKey, DatabaseEntry data, LockMode lockMode)` Move the cursor to the next key/data pair and return 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, move the cursor to the next key/data pair of the database and return that pair.
`OperationStatus` | `getNextNoDup(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)` Move the cursor to the next non-duplicate key/data pair and return that pair.
`OperationStatus` | `getPrev(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)` Move the cursor to the previous key/data pair and return 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, move the cursor to the previous key/data pair of the database and return that pair.
`OperationStatus` | `getPrevNoDup(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)` Move the cursor to the previous non-duplicate key/data pair and return that pair.
`OperationStatus` | `getRecordNumber(DatabaseEntry secondaryRecno, DatabaseEntry primaryRecno, LockMode lockMode)` Return the record number associated with the cursor.
`OperationStatus` | `getSearchBoth(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)` Move the cursor to the specified secondary and primary key, where both the primary and secondary key items must match.
`OperationStatus` | `getSearchBothRange(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)` Move the cursor to the specified secondary key and closest matching primary key of the database.
`OperationStatus` | `getSearchKey(DatabaseEntry key, DatabaseEntry pKey, 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 pKey, 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 secondaryRecno, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)` Move the cursor to the specific numbered record of the database, and return the associated key/data pair.
`SecondaryDatabase` | `getSecondaryDatabase()` Return the SecondaryDatabase handle associated with this Cursor.

Methods inherited from class com.sleepycat.db.Cursor
`close, count, delete, getConfig, getCurrent, getDatabase, getFirst, getLast, getNext, getNextDup, getNextNoDup, getPrev, getPrevDup, getPrevNoDup, getPriority, getRecordNumber, getSearchBoth, getSearchBothRange, getSearchKey, getSearchKeyRange, getSearchRecordNumber, put, putAfter, putBefore, putCurrent, putKeyFirst, putKeyLast, putNoDupData, putNoOverwrite, setPriority`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### dup

    public Cursor dup(boolean samePosition)
               throws DatabaseException

  Returns a new `SecondaryCursor` for the same transaction as the original cursor.

  Overrides:
    `dup` in class `Cursor`
  Parameters:
    `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.

  Returns:
    A new cursor with the same transaction and locker ID as the original cursor.

  Throws:
    `DatabaseException` - if a failure occurs.

### dupSecondary

    public SecondaryCursor dupSecondary(boolean samePosition)
                                 throws DatabaseException

  Returns a new copy of the cursor as a `SecondaryCursor`.

  Calling this method is the equivalent of calling `dup(boolean)` and casting the result to `SecondaryCursor`.

  Throws:
    `DatabaseException`
  See Also:
    `dup(boolean)`

### getCurrent

    public OperationStatus getCurrent(DatabaseEntry key,
                                      DatabaseEntry pKey,
                                      DatabaseEntry data,
                                      LockMode lockMode)
                               throws DatabaseException

  Returns the key/data pair to which the cursor refers.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `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. 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.
  Returns:
    `OperationStatus.KEYEMPTY` if the key/pair at the cursor position has been deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getFirst

    public OperationStatus getFirst(DatabaseEntry key,
                                    DatabaseEntry pKey,
                                    DatabaseEntry data,
                                    LockMode lockMode)
                             throws DatabaseException

  Move the cursor to the first key/data pair of the database, and return that pair. If the first key has duplicate values, the first data item in the set of duplicates is returned.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `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. 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getLast

    public OperationStatus getLast(DatabaseEntry key,
                                   DatabaseEntry pKey,
                                   DatabaseEntry data,
                                   LockMode lockMode)
                            throws DatabaseException

  Move the cursor to the last key/data pair of the database, and return that pair. If the last key has duplicate values, the last data item in the set of duplicates is returned.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getNext

    public OperationStatus getNext(DatabaseEntry key,
                                   DatabaseEntry pKey,
                                   DatabaseEntry data,
                                   LockMode lockMode)
                            throws DatabaseException

  Move the cursor to the next key/data pair and return that pair. If the matching key has duplicate values, the first data item in the set of duplicates is returned.

  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.

  Parameters:
    `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. 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getNextDup

    public OperationStatus getNextDup(DatabaseEntry key,
                                      DatabaseEntry pKey,
                                      DatabaseEntry data,
                                      LockMode lockMode)
                               throws DatabaseException

  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.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `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. 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getNextNoDup

    public OperationStatus getNextNoDup(DatabaseEntry key,
                                        DatabaseEntry pKey,
                                        DatabaseEntry data,
                                        LockMode lockMode)
                                 throws DatabaseException

  Move the cursor to the next non-duplicate key/data pair and return that pair. If the matching key has duplicate values, the first data item in the set of duplicates is returned.

  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.

  Parameters:
    `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. 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getPrev

    public OperationStatus getPrev(DatabaseEntry key,
                                   DatabaseEntry pKey,
                                   DatabaseEntry data,
                                   LockMode lockMode)
                            throws DatabaseException

  Move the cursor to the previous key/data pair and return that pair. If the matching key has duplicate values, the last data item in the set of duplicates is returned.

  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.

  Parameters:
    `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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getPrevDup

    public OperationStatus getPrevDup(DatabaseEntry key,
                                      DatabaseEntry pKey,
                                      DatabaseEntry data,
                                      LockMode lockMode)
                               throws DatabaseException

  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.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getPrevNoDup

    public OperationStatus getPrevNoDup(DatabaseEntry key,
                                        DatabaseEntry pKey,
                                        DatabaseEntry data,
                                        LockMode lockMode)
                                 throws DatabaseException

  Move the cursor to the previous non-duplicate key/data pair and return that pair. If the matching key has duplicate values, the last data item in the set of duplicates is returned.

  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.

  Parameters:
    `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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getSearchKey

    public OperationStatus getSearchKey(DatabaseEntry key,
                                        DatabaseEntry pKey,
                                        DatabaseEntry data,
                                        LockMode lockMode)
                                 throws DatabaseException

  Move the cursor to the given key of the database, and return the datum associated with the given key. If the matching key has duplicate values, the first data item in the set of duplicates is returned.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `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. 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getSearchKeyRange

    public OperationStatus getSearchKeyRange(DatabaseEntry key,
                                             DatabaseEntry pKey,
                                             DatabaseEntry data,
                                             LockMode lockMode)
                                      throws DatabaseException

  Move the cursor to the closest matching key of the database, and return the data item associated with the matching key. If the matching key has duplicate values, the first data item in the set of duplicates is returned.

  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.

  Parameters:
    `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. 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getSearchBoth

    public OperationStatus getSearchBoth(DatabaseEntry key,
                                         DatabaseEntry pKey,
                                         DatabaseEntry data,
                                         LockMode lockMode)
                                  throws DatabaseException

  Move the cursor to the specified secondary and primary key, where both the primary and secondary key items must match.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getSearchBothRange

    public OperationStatus getSearchBothRange(DatabaseEntry key,
                                              DatabaseEntry pKey,
                                              DatabaseEntry data,
                                              LockMode lockMode)
                                       throws DatabaseException

  Move the cursor to the specified secondary key and closest matching primary key of the database.

  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.

  Parameters:
    `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 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getSecondaryDatabase

    public SecondaryDatabase getSecondaryDatabase()

  Return the SecondaryDatabase handle associated with this Cursor.

  Returns:
    The SecondaryDatabase handle associated with this Cursor.

### getRecordNumber

    public OperationStatus getRecordNumber(DatabaseEntry secondaryRecno,
                                           DatabaseEntry primaryRecno,
                                           LockMode lockMode)
                                    throws DatabaseException

  Return the record number associated with the cursor. The record number will be returned in the data parameter.

  For this method to be called, the underlying database must be of type Btree, and it must have been configured to support record numbers.

  When called on a cursor opened on a database that has been made into a secondary index, the method returns the record numbers of both the secondary and primary databases. If either underlying database is not of type Btree or is not configured with record numbers, the out-of-band record number of 0 is returned.

  If this method fails for any reason, the position of the cursor will be unchanged.

  Parameters:
    `secondaryRecno` - the secondary record number returned as output. Its byte array does not need to be initialized by the caller.
    `primaryRecno` - the primary record number 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

### getSearchRecordNumber

    public OperationStatus getSearchRecordNumber(DatabaseEntry secondaryRecno,
                                                 DatabaseEntry pKey,
                                                 DatabaseEntry data,
                                                 LockMode lockMode)
                                          throws DatabaseException

  Move the cursor to the specific numbered record of the database, and return the associated key/data pair.

  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.

  Parameters:
    `secondaryRecno` - the secondary record number used as input. It must be initialized with a non-null byte array by the caller.
    `data` - the primary 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.
  Returns:
    `OperationStatus.NOTFOUND` if no matching key/data pair is found; `OperationStatus.KEYEMPTY` if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, `OperationStatus.SUCCESS`.
  Throws:
    `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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.6.21
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996,2007 Oracle. All rights reserved.