Berkeley DB: DBENV->close
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# DBENV->close |

`

###

    #include <db.h>

    int
    DBENV->close(DB_ENV *dbenv, u_int32_t flags);

# Description

The DBENV->close function closes the Berkeley DB environment, freeing any allocated resources and closing any underlying subsystems.

Calling DBENV->close does not imply closing any databases that were opened in the environment.

The flags parameter is currently unused, and must be set to 0.

Where the environment was initialized with the DB_INIT_LOCK flag, calling DBENV->close does not release any locks still held by the closing process, providing functionality for long-lived locks. Processes that wish to have all their locks released can do so by issuing the appropriate lock_vec call.

Where the environment was initialized with the DB_INIT_MPOOL flag, calling DBENV->close implies calls to memp_fclose for any remaining open files in the memory pool that were returned to this process by calls to memp_fopen. It does not imply a call to memp_fsync for those files.

Where the environment was initialized with the DB_INIT_TXN flag, calling DBENV->close aborts any uncommitted transactions. (Applications are should not depend on this behavior. If the process' has already closed a database handle which is necessary to abort an uncommitted transaction, the Berkeley DB environment must then require that recovery be run before further operations are done, since once a transaction exists that cannot be committed or aborted, no future checkpoint can ever succeed.)

In multi-threaded applications, only a single thread may call DBENV->close.

Once DBENV->close has been called, regardless of its return, the Berkeley DB environment handle may not be accessed again.

The DBENV->close function returns a non-zero error value on failure and 0 on success.

# Errors

The DBENV->close function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DBENV->close function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

# See Also

DBENV->close, db_env_create, DBENV->open, DBENV->remove, DBENV->err, db_strerror, db_version, DBENV->set_cachesize, DBENV->set_errcall, DBENV->set_errfile, DBENV->set_errpfx, DBENV->set_paniccall, and DBENV->set_verbose.`

Copyright Sleepycat Software