Berkeley DB Reference Guide: Upgrading Berkeley DB Applications
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++

### Berkeley DB Reference Guide: Upgrading Berkeley DB Applications |

# Release 3.0: the DB_ENV structure

The DB_ENV structure is now opaque for applications in the Berkeley DB 3.0 release. Accesses to any fields within that structure by the application should be replaced with method calls. The following example illustrates this using the historic errpfx structure field. In the Berkeley DB 2.X releases, applications set error prefixes using code similar to the following:

>     DB_ENV *dbenv;

>     	dbenv->errpfx = "my prefix";

in the Berkeley DB 3.X releases, this should be done using the DBENV->set_errpfx method, as follows:

>     DB_ENV *dbenv;

>     	dbenv->set_errpfx(dbenv, "my prefix");

The following table lists the DB_ENV fields previously used by applications and the methods that should now be used to set them.

DB_ENV field | Berkeley DB 3.X method
--- | ---
db_errcall | DBENV->set_errcall
db_errfile | DBENV->set_errfile
db_errpfx | DBENV->set_errpfx
db_lorder | This field was removed from the DB_ENV structure in the Berkeley DB 3.0 release as no application should have ever used it. Any code using it should be evaluated for potential bugs.
db_paniccall | DBENV->set_paniccall
db_verbose | DBENV->set_verbose Note: the db_verbose field was a simple boolean toggle, the DBENV->set_verbose method takes arguments that specify exactly which verbose messages are desired.
lg_max | DBENV->set_lg_max
lk_conflicts | DBENV->set_lk_conflicts
lk_detect | DBENV->set_lk_detect
lk_max | DBENV->set_lk_max
lk_modes | DBENV->set_lk_conflicts
mp_mmapsize | DBENV->set_mp_mmapsize
mp_size | DBENV->set_cachesize Note: the DBENV->set_cachesize function takes additional arguments. Setting both the second argument (the number of GB in the pool) and the last argument (the number of memory pools to create) to 0 will result in behavior that is backward compatible with previous Berkeley DB releases.
tx_info | This field was used by applications as an argument to the transaction subsystem functions. As those functions take references to a DB_ENV structure as arguments in the Berkeley DB 3.0 release, it should no longer be used by any application.
tx_max | DBENV->set_tx_max
tx_recover | DBENV->set_tx_recover

Copyright Sleepycat Software