DbException
NAME
DbException - Exception class for Db activity
SYNOPSIS
#include <db_cxx.h>
DbException::DbException(int err);
DbException::DbException(const char *description);
DbException::DbException(const char *prefix, int err);
DbException::DbException(const char *prefix1,
const char *prefix2, int err);
const int
DbException::get_errno();
virtual const char *
DbException::what() const;
DESCRIPTION
The DB library is a family of classes that provides a mod-
ular programming interface to transactions and record-ori-
ented file access. The library includes support for
transactions, locking, logging and file page caching, as
well as various indexed access methods. Many of the
classes (e.g., the file page caching class) are useful
independent of the other DB classes, although some classes
are explicitly based on other classes (e.g., transactions
and logging). For a general description of the DB pack-
age, see db_intro(3).
This manual page describes the DbException class and how
it is used by the various Db* classes.
Most methods in the Db classes return an int but also
throw an exception. This allows for two different error
behaviors, that are known as error models. By default,
the error model is configured to throw an exception when-
ever a serious error occurs. This generally allows for
cleaner logic for transaction processing, as a try block
can surround a single transaction. Alternatively, the
error model can be set to not throw exceptions, and
instead request the individual function to return an error
code. The error model can be changed using the
DbEnv::set_error_model method, see DbEnv(3).
A DbException object contains an informational string and
an errno. The errno can be obtained using DbExcep-
tion::get_errno(). The informational string can be
obtained using DbException::what().
We expect in the future that this class will inherit from
the standard class exception, but certain language imple-
mentation bugs currently prevent this on some platforms.
DbLock(3), DbLocktab(3), DbLog(3), DbLsn(3), DbMpool(3),
DbMpoolFile(3), Dbt(3), DbTxn(3), DbTxnMgr(3)