Chapter 3.  Db_container

This class is the base class for all db container classes, you don't directly use this class, but all container classes inherit from this class, so you need to know the methods that can be accessed via concrete container classes.

This class is also used to support auto commit transactions. Autocommit is enabled when DB_AUTO_COMMIT is set to the database or database environment handle and the environment is transactional.

Inside dbstl, there are transactions begun and committed/aborted if the backing database and/or environment requires auto commit, and there are cursors opened internally, and you can set the flags used by the transaction and cursor functions via set functions of this class.

All dbstl containers are fully multi-threaded, you should not need any synchronization to use them in the correct way, but this class is not thread safe, access to its members are not proctected by any mutex because the data members of this class are supposed to be set before they are used, and remain read only afterwards. If this is not the case, you must synchronize the access.

Public Members

Member Description

Get the backing database's open flags.


Get the backing database's flags that are set via Db::set_flags() function.


Get the backing database's handle.


Get the backing database environment's handle.


Set the underlying database's handle, and optionally environment handle if the environment has also changed.


Set the flags required by the Berkeley DB functions DbEnv::txn_begin(), DbTxn::commit() and DbEnv::cursor().


Set flag of DbEnv::txn_begin() call.


Get flag of DbEnv::txn_begin() call.


Set flag of DbTxn::commit() call.


Get flag of DbTxn::commit() call.


Get flag of Db::cursor() call.


Set flag of Db::cursor() call.


Default constructor.


The backing database is not closed in this function.


Dbstl Container Classes


Function Details

u_int32_t get_db_open_flags() const

Get the backing database's open flags.

Return Value

The backing database's open flags.

Group: Get and set functions for data members.

Note that these functions are not thread safe, because all data members of db_container are supposed to be set on container construction and initialization, and remain read only afterwards.