import com.sleepycat.db.*;public int get(Dbt key, Dbt data, int flags) throws DbException;
The Dbc.get method retrieves key/data pairs from the database. The byte array and length of the key are returned in the object referenced by key (except for the case of the DB_SET flag where the key object is unchanged), and the address and length of the data are returned in the object referenced by data.
Modifications to the database during a sequential scan will be reflected in the scan, i.e. records inserted behind a cursor will not be returned while records inserted in front of a cursor will be returned.
In Recno databases, missing entries (i.e., entries that were never explicitly created or that were created and then deleted), will be skipped during a sequential scan.
If multiple threads or processes insert items into the same database file without using locking, the results are undefined. For more detail, see cursor stability.
The flags parameter must be set to one of the following values:
If the database is a Recno database, Dbc.get using the Db.DB_FIRST flag will skip any keys that exist but were never explicitly created by the application or were created and later deleted.
If the database is empty, Dbc.get will return DB_NOTFOUND.
If the database is a Recno database, Dbc.get using the
Db.DB_LAST flag will skip any keys that exist but were never
explicitly created by the application or were created and later deleted.
If the database is empty, Dbc.get will return DB_NOTFOUND.
Otherwise, move the cursor 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 the database is a Recno database, Dbc.get using the
Db.DB_NEXT flag will skip any keys that exist but were never
explicitly created by the application or were created and later deleted.
If the cursor is already on the last record in the database, Dbc.get
will return DB_NOTFOUND.
If the cursor is not yet initialized, the Dbc.get
method throws an exception that encapsulates EINVAL.
Otherwise, move the cursor 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 the database is a Recno database, Dbc.get using the
Db.DB_PREV flag will skip any keys that exist but were never
explicitly created by the application or were created and later deleted.
If the cursor is already on the first record in the database, Dbc.get
will return DB_NOTFOUND.
If the cursor key/data pair was deleted, Dbc.get will return
DB_KEYEMPTY.
If the cursor is not yet initialized, the Dbc.get
method throws an exception that encapsulates EINVAL.
In the presence of duplicate key values, Dbc.get will return the
first data item for the given key.
If the database is a Recno database and the requested key exists, but was
never explicitly created by the application or was later deleted,
Dbc.get will return DB_KEYEMPTY.
If no matching keys are found, Dbc.get will return DB_NOTFOUND.
For DB_SET_RECNO to be specified, the underlying database must be of
type btree and it must have been created with the Db.DB_RECNUM flag.
For DB_GET_RECNO to be specified, the underlying database must be of
type btree and it must have been created with the Db.DB_RECNUM flag.
In addition, the following value may be set by logically OR'ing it into the flags parameter:
Otherwise, the Dbc.get method throws an exception that encapsulates an errno on failure.
If Dbc.get fails for any reason, the state of the cursor will be unchanged.
The Dbc.get method may fail and throw an exception for any of the errors specified for the following Berkeley DB and C library functions: __account_page(3), abort(3), dbenv->db_paniccall(3), dbp->dup_compare(3), fflush(3), fprintf(3), free(3), func(3), hcp->dbc->dbp->h_hash(3), DbLockTab.get, DbLock.put, DbLockTab.vec, DbLog.put, malloc(3), memcmp(3), memcpy(3), memmove(3), DbMpoolFile.get, DbMpoolFile.put, DbMpoolFile.set, memset(3), realloc(3), strerror(3), vfprintf(3), and vsnprintf(3).
In addition, the Dbc.get method may fail and throw an exception encapsulating errno for the following conditions:
The specified cursor was not currently initialized.
The Db.DB_THREAD flag was specified to Db.open and neither the Db.DB_DBT_MALLOC or Db.DB_DBT_USERMEM flags were set in the Dbt.