Berkeley DB: DbLogc.logc_get
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# DbLogc.logc_get |

`

###

    import com.sleepycat.db.*;

    public int get(DbLsn lsn, Dbt data, int flags)
        throws DbException;

# Description

The DbLogc.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.DB_DBT_MALLOC, Db.DB_DBT_REALLOC and Db.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.DB_CHECKPOINT
  The last record written with the DB_CHECKPOINT flag specified to the DbEnv.log_put method is returned in the data argument. The lsn argument is overwritten with the DbLsn of the record returned. If no record has been previously written with the DB_CHECKPOINT flag specified, the first record in the log is returned.

  If the log is empty, the DbLogc.logc_get method will return Db.DB_NOTFOUND.

Db.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 DbLsn of the record returned.

  If the log is empty, the DbLogc.logc_get method will return Db.DB_NOTFOUND.

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

  If the log is empty, the DbLogc.logc_get method will return Db.DB_NOTFOUND.

Db.DB_NEXT, Db.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 DbLsn of the record returned.

  If the pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, DbLogc.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 DbLogc.logc_get method will return Db.DB_NOTFOUND.

  If the log was opened with the DB_THREAD flag set, calls to DbLogc.logc_get with the DB_NEXT (DB_PREV) flag set will return EINVAL.

Db.DB_CURRENT
  Return the log record to which the log currently refers.

  If the log pointer 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, DbLogc.logc_get will return EINVAL.

Db.DB_SET
  Retrieve the record specified by the lsn argument. If the specified DbLsn is invalid (for example, it does not appear in the log) DbLogc.logc_get will return EINVAL.

Otherwise, the DbLogc.logc_get method throws an exception that encapsulates a non-zero error value on failure.

# Errors

The DbLogc.logc_get method may fail and throw an exception encapsulating 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 DbLogc.logc_get method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbLogc.logc_get method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

# Class

DbEnv

# See Also

DbEnv.set_lg_bsize, DbEnv.set_lg_dir, DbEnv.set_lg_max, DbEnv.set_lg_regionmax, DbEnv.log_archive, DbEnv.log_compare, DbEnv.log_cursor, DbEnv.log_file, DbEnv.log_flush, DbEnv.log_put, DbEnv.log_register, DbEnv.log_stat, DbEnv.log_unregister, DbLogc.logc_close and DbLogc.logc_get.`

Copyright Sleepycat Software