DbLogc::get
|
|
#include <db_cxx.h>
int
DbLogc::get(DbLsn *lsn, Dbt *data, u_int32_t flags);
Description: DbLogc::get
The DbLogc::get method returns records from the log.
Unless otherwise specified, the DbLogc::get method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
Parameters
- data
- The data field of the data structure is set to the record
retrieved, and the size field indicates the number of bytes in the
record. See Dbt for a description of other fields in the
data structure. The DB_DBT_MALLOC,
DB_DBT_REALLOC and DB_DBT_USERMEM flags may be specified
for any Dbt used for data retrieval.
- flags
- The flags parameter must be set to one of the following values:
- DB_CURRENT
- Return the log record to which the log currently refers.
- DB_FIRST
- The first record from any of the log files found in the log directory
is returned in the data parameter.
The lsn parameter is overwritten with the DbLsn of the
record returned.
The DbLogc::get method will return DB_NOTFOUND if DB_FIRST is set and the log is empty.
- DB_LAST
- The last record in the log is returned in the data parameter.
The lsn parameter is overwritten with the DbLsn of the
record returned.
The DbLogc::get method will return DB_NOTFOUND if DB_LAST is set and the log is empty.
- DB_NEXT
- The current log position is advanced to the next record in the log, and
that record is returned in the data parameter. The lsn
parameter is overwritten with the DbLsn of the record returned.
If the cursor has not been initialized via DB_FIRST, DB_LAST, DB_SET,
DB_NEXT, or DB_PREV, DbLogc::get will return the first record in
the log.
The DbLogc::get method will return DB_NOTFOUND if DB_NEXT is set and the last log record has already been
returned or the log is empty.
- DB_PREV
- The current log position is advanced to the previous record in the log,
and that record is returned in the data parameter. The
lsn parameter is overwritten with the DbLsn of the record
returned.
If the cursor has not been initialized via DB_FIRST, DB_LAST, DB_SET,
DB_NEXT, or DB_PREV, DbLogc::get will return the last record in the
log.
The DbLogc::get method will return DB_NOTFOUND if DB_PREV is set and the first log record has already been
returned or the log is empty.
- DB_SET
- Retrieve the record specified by the lsn parameter.
- lsn
- When the flag parameter is set to DB_CURRENT,
DB_FIRST, DB_LAST, DB_NEXT or DB_PREV,
the lsn parameter is overwritten with the DbLsn value
of the record retrieved. When flag is set to DB_SET,
the lsn parameter is the DbLsn value of the record to
be retrieved.
Errors
The DbLogc::get method
may fail and throw
DbException,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:
- EINVAL
- If the DB_CURRENT flag was set and the log cursor has not yet
been initialized;
the DB_CURRENT, DB_NEXT, or DB_PREV flags were
set and the log was opened with the DB_THREAD flag set;
the DB_SET flag was set and the specified log sequence number
does not appear in the log; or if an
invalid flag value or parameter was specified.
Class
DbEnv, DbLogc, DbLsn
See Also
Logging Subsystem and Related Methods
Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.