Library Version 18.1.40

Chapter 1. Dbstl Global Public Functions
Prev |  | Next

## Chapter 1. Dbstl Global Public Functions

#### Public Members

Member | Description
--- | ---
close_db | Close pdb regardless of reference count.
close_all_dbs | Close all open database handles regardless of reference count.
close_db_env | Close specified database environment handle regardless of reference count.
close_all_db_envs | Close all open database environment handles regardless of reference count.
begin_txn | Begin a new transaction from the specified environment "env".
commit_txn | Commit current transaction opened in the environment "env".
abort_txn | Abort current transaction of environment "env".
current_txn | Get current transaction of environment "env".
set_current_txn_handle | Set environment env's current transaction handle to be newtxn.
register_db | Register a Db handle "pdb1".
register_db_env | Register a DbEnv handle env1, this handle and handles opened in it will be closed by ResourceManager .
open_db | Helper function to open a database and register it into dbstl for the calling thread.
open_env | Helper function to open an environment and register it into dbstl for the calling thread.
alloc_mutex | Allocate a Berkeley DB mutex.
lock_mutex | Lock a mutex, wait if it is held by another thread.
unlock_mutex | Unlock a mutex, and return immediately.
free_mutex | Free a mutex, and return immediately.
dbstl_startup | If there are multiple threads within a process that make use of dbstl, then this function should be called in a single thread mutual exclusively before any use of dbstl in a process; Otherwise, you don't need to call it, but are allowed to call it anyway.
dbstl_exit | This function releases any memory allocated in the heap by code of dbstl.
dbstl_thread_exit | This function closes all Berkeley DB handles in the right order, if other threads do not use them.
operator== | Operators to compare two Dbt objects.
set_global_dbfile_suffix_number | If exisiting random temporary database name generation mechanism is still causing name clashes, users can set this global suffix number which will be append to each temporary database file name and incremented after each append, and by default it is 0.
close_db_cursors | Close cursors opened in dbp1.

#### Group

None

## close_db

### Function Details

     void close_db(Db *pdb)

Close pdb regardless of reference count.

You must make sure pdb is not used by others before calling this method. You can close the underlying database of a container and assign another database with right configurations to it, if the configuration is not suitable for the container, there will be an InvalidArgumentException type of exception thrown. You can't use the container after you called close_db and before setting another valid database handle to the container via db_container::set_db_handle() function.

#### Parameters

##### pdb

The database handle to close.

### Group: Functions to close database/environments.

Normally you don't have to close any database or environment handles, they will be closed automatically.

Though you still have the following API to close them.

### Class

dbstl_global_functions

Prev |  | Next
For More Information | Home | close_all_dbs