*I&Berkeley DB: DbLog::get[P

DbLog::get





#include <db_cxx.h>

int3DbLog::get(DbLsn *lsn, Dbt *data, u_int32_t flags);





Description



<The DbLog::get method implements a cursor inside of the log,?retrieving records from the log according to the lsn andflags arguments.

JThe data field of the data structure is set to the record retrieved?and the size field indicates the number of bytes in the record.gSee Dbt for a description of other fields in the data structure.HWhen multiple threads are using the returned log handle concurrently,¨either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must`be specified for any Dbt used for data retrieval.

MThe flags argument must be set to exactly one of the following values:

\

DB_CHECKPOINT
The last record written with the DB_CHECKPOINT flag specified to thejDbLog::put method is returned in the data argument. Thellsn argument is overwritten with the DbLsn of the recordJreturned. If no record has been previously written with the DB_CHECKPOINT8flag specified, the first record in the log is returned.

CIf the log is empty, the DbLog::get method will return DB_NOTFOUND.X

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

CIf the log is empty, the DbLog::get method will return DB_NOTFOUND.U

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

CIf the log is empty, the DbLog::get method will return DB_NOTFOUND.]

DB_NEXT
The current log position is advanced to the next record in the log and that/record is returned in the data argument.iThe lsn argument is overwritten with the DbLsn of therecord returned.

FIf the pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET,HDB_NEXT, or DB_PREV, DbLog::get will return the first record in the log.IIf the last log record has already been returned or the log is empty, the*DbLog::get method will return DB_NOTFOUND.

;If the log was opened with the DB_THREAD flag set, calls to8DbLog::get with the DB_NEXT flag set will return EINVAL.^

DB_PREV
The current log position is moved to the previous record in the log and that/record is returned in the data argument.iThe lsn argument is overwritten with the DbLsn of therecord returned.

FIf the pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET,DB_NEXT, or DB_PREV,2DbLog::get will return the last record in the log.JIf the first log record has already been returned or the log is empty, the*DbLog::get method will return DB_NOTFOUND.

;If the log was opened with the DB_THREAD flag set, calls to8DbLog::get with the DB_PREV flag set will return EINVAL.K

DB_CURRENT
Return the log record currently referenced by the log.

JIf the log pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET,JDB_NEXT, or DB_PREV, or if the log was opened with the DB_THREAD flag set,DbLog::get will return EINVAL.R

DB_SET
Retrieve the record specified by the lsn argument. If thejspecified DbLsn is invalid (e.g., does not appear in the log)DbLog::get will return EINVAL.


Otherwise, the DbLog::get>method either returns errno or throws an exception that:encapsulates an errno on failure, and 0 on success.



Errors

QIf a fatal error occurs in Berkeley DB, the DbLog::get method may fail and eitherIreturn DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY,Gat which point all subsequent database calls will also fail in the sameFway. Methods marked as returning errno will, by default, throwHan exception that encapsulates the error information. The default error\behavior can be changed, see DbException.

The DbLog::get&method may fail and throw an exceptionKfor any of the errors specified for the following Berkeley DB and C library functions: abort(3),atoi(3), close(3), closedir(3), fcntl(3), fflush(3), fprintf(3),free(3), getenv(3), getpid(3), getuid(3), isdigit(3), lseek(3), malloc(3), memcpy(3), memset(3),open(3), opendir(3),read(3), readdir(3), realloc(3),sigfillset(3),sigprocmask(3), snprintf(3),stat(3), strchr(3), strerror(3), strlen(3), strncmp(3), unlink(3), vfprintf(3),and vsnprintf(3).

In addition, the DbLog::get&method may fail and throw an exceptionor return errnofor the following conditions:

B

EINVAL
An invalid flag value or parameter was specified.

<The DB_FIRST flag was specified and no log files were found.





Class

2DbLog



See Also

>DbLog::archive,:DbLog::close,>DbLog::compare,8DbLog::file,:DbLog::flush, DbLog::get,8DbLog::open,6DbLog::put,FDbLog::db_register,8DbLog::stat,;DbLog::unlinkandJDbLog::db_unregister.
ÿÿ