#include <db_cxx.h> int DbStream::read(Dbt *data, db_off_t offset, u_int32_t size, u_int32_t flags);
The DbStream::read()
method reads
size bytes from the external file,
starting at offset, into the
DBT data.
The stream is created using Dbc::db_stream() .
Unless otherwise specified, the
DbStream::read()
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.
The data parameter is the Dbt into which you want to place the data read using this method.
Note that the data DBT must be set with one of the following flags, or this method will return an error: DB_DBT_MALLOC, DB_DBT_REALLOC, DB_DBT_USERMEM, or DB_DBT_APPMALLOC.
The offset parameter indicates the starting position, in bytes, from the beginning of the external file where you want the read to begin.
The DbStream::read()
method may fail and throw a DbException
exception, encapsulating one of the following non-zero errors, or return one
of the following non-zero errors:
The Dbt provided to this method was not configured appropriately, and so there is not enough space allocated for the bytes you are trying to read.
An invalid flag value or parameter was specified; or if the Dbt was configured with DB_DBT_PARTIAL.