DB_LOGC->get

APIRef

#include <db.h>

int DB_LOGC->get(DB_LOGC *logc, DB_LSN *lsn, DBT *data, u_int32_t flags);

Description

The DB_LOGC->get method retrieve records from the log according to the lsn and flags arguments.

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.

The flags value must be set to one of the following values:

DB_FIRST
The first record from any of the log files found in the log directory is returned in the data argument. The lsn argument is overwritten with the DB_LSN of the record returned.

If the log is empty, the DB_LOGC->get method will return DB_NOTFOUND.

DB_LAST
The last record in the log is returned in the data argument. The lsn argument is overwritten with the DB_LSN of the record returned.

If the log is empty, the DB_LOGC->get method will return DB_NOTFOUND.

DB_NEXT, DB_PREV
The current log position is advanced to the next (previous) record in the log, and that record is returned in the data argument. The lsn argument is overwritten with the DB_LSN of the record returned.

If the cursor has not been initialized via DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, DB_LOGC->get will return the first (last) record in the log. If the last (first) log record has already been returned or the log is empty, the DB_LOGC->get method will return DB_NOTFOUND. If the log was opened with the DB_THREAD flag set, calls to DB_LOGC->get with the DB_NEXT (DB_PREV) flag set, the DB_LOGC->get method will return EINVAL.

DB_CURRENT
Return the log record to which the log currently refers. If the log cursor has not been initialized via DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, or if the log was opened with the DB_THREAD flag set, the DB_LOGC->get method will return EINVAL.

DB_SET
Retrieve the record specified by the lsn argument. If the specified DB_LSN is invalid (for example, it does not appear in the log), the DB_LOGC->get method will return EINVAL.

Otherwise, the DB_LOGC->get method returns a non-zero error value on failure and 0 on success.

Errors

The DB_LOGC->get method may fail and return a non-zero error for the following conditions:

EINVAL
An invalid flag value or parameter was specified.

The DB_CURRENT flag was set and the log pointer had not yet been initialized.

The DB_SET flag was set and the specified log sequence number does not exist.

The DB_LOGC->get method may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB_LOGC->get method may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

Class

DB_ENV, DB_LOGC, DB_LSN

See Also

Logging Subsystem and Related Methods

APIRef

Copyright Sleepycat Software