Db

APIRef

#include <db_cxx.h>

class Db { public: Db(DbEnv *dbenv, u_int32_t flags); ~Db();

DB *Db::get_DB(); const DB *Db::get_const_DB() const; static Db *Db::get_Db(DB *db); static const Db *Db::get_const_Db(const DB *db); ... };

Description

This manual page describes the specific details of the Db class, which is the center of access method activity.

If no dbenv value is specified, the database is standalone; that is, it is not part of any Berkeley DB environment.

If a dbenv value is specified, the database is created within the specified Berkeley DB environment. The database access methods automatically make calls to the other subsystems in Berkeley DB based on the enclosing environment. For example, if the environment has been configured to use locking, the access methods will automatically acquire the correct locks when reading and writing pages of the database.

The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:

DB_CXX_NO_EXCEPTIONS
The Berkeley DB C++ API supports two different error behaviors. By default, whenever an error occurs, an exception is thrown that encapsulates the error information. This generally allows for cleaner logic for transaction processing because a try block can surround a single transaction. However, if DB_CXX_NO_EXCEPTIONS is specified, exceptions are not thrown; instead, each individual function returns an error code.

If dbenv is not null, this flag is ignored, and the error behavior of the specified environment is used instead.

DB_XA_CREATE
Instead of creating a standalone database, create a database intended to be accessed via applications running under a X/Open conformant Transaction Manager. The database will be opened in the environment specified by the OPENINFO parameter of the GROUPS section of the ubbconfig file. See the XA Resource Manager chapter in the Reference Guide for more information.

Each Db object has an associated DB struct, which is used by the underlying implementation of Berkeley DB and its C-language API. The Db::get_DB method returns a pointer to this struct. Given a const Db object, Db::get_const_DB returns a const pointer to the same struct.

Given a DB struct, the Db::get_Db method returns the corresponding Db object, if there is one. If the DB object was not associated with a Db (that is, it was not returned from a call to Db::get_DB), then the result of Db::get_Db is undefined. Given a const DB struct, Db::get_const_Db returns the associated const Db object, if there is one.

These methods may be useful for Berkeley DB applications including both C and C++ language software. It should not be necessary to use these calls in a purely C++ application.

Class

Db

See Also

Db::associate, Db::close, Db::cursor, Db::del, Db::err, Db::errx Db::fd, Db::get, Db::pget, Db::get_byteswapped, Db::get_type, Db::join, Db::key_range, Db::open, Db::put, Db::remove, Db::rename, Db::set_alloc, Db::set_append_recno, Db::set_bt_compare, Db::set_bt_minkey, Db::set_bt_prefix, Db::set_cachesize, Db::set_dup_compare, Db::set_errcall, Db::set_errfile, Db::set_errpfx, Db::set_feedback, Db::set_flags, Db::set_h_ffactor, Db::set_h_hash, Db::set_h_nelem, Db::set_lorder, Db::set_pagesize, Db::set_paniccall, Db::set_q_extentsize, Db::set_re_delim, Db::set_re_len, Db::set_re_pad, Db::set_re_source, Db::stat, Db::sync, Db::truncate, Db::upgrade, and Db::verify.

APIRef

Copyright Sleepycat Software