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

# Release 3.0: function arguments

In Berkeley DB 3.0, there are no longer separate structures that represent each subsystem (e.g., DB_LOCKTAB or DB_TXNMGR), and an overall DB_ENV environment structure. Instead there is only the DB_ENV structure. This means that DB_ENV references should be passed around by your application instead of passing around DB_LOCKTAB or DB_TXNMGR references.

Each of the following functions:

>     lock_detect
>     lock_get
>     lock_id
>     lock_put
>     lock_stat
>     lock_vec

should have its first argument, a reference to the DB_LOCKTAB structure, replaced with a reference to the enclosing DB_ENV structure. For example, the following line of code from a Berkeley DB 2.X application:

>     DB_LOCKTAB *lt;
>     DB_LOCK lock;
>     	ret = lock_put(lt, lock);

should now be written as follows:

>     DB_ENV *dbenv;
>     DB_LOCK *lock;
>     	ret = lock_put(dbenv, lock);

Similarly, all of the functions:

>     log_archive
>     log_compare
>     log_file
>     log_flush
>     log_get
>     log_put
>     log_register
>     log_stat
>     log_unregister

should have their DB_LOG argument replaced with a reference to a DB_ENV structure, and the functions:

>     memp_fopen
>     memp_register
>     memp_stat
>     memp_sync
>     memp_trickle

should have their DB_MPOOL argument replaced with a reference to a DB_ENV structure.

You should remove all references to DB_LOCKTAB, DB_LOG, DB_MPOOL, and DB_TXNMGR structures from your application, they are no longer useful in any way. In fact, a simple way to identify all of the places that need to be upgraded is to remove all such structures and variables they declare, and then compile. You will see a warning message from your compiler in each case that needs to be upgraded.

Copyright Sleepycat Software