Berkeley DB Reference Guide:
Upgrading Berkeley DB Applications

PrevRefNext

Release 3.0: the DB structure

The DB 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 type structure field. In the Berkeley DB 2.X releases, applications could find the type of an underlying database using code similar to the following:

DB *db;
DB_TYPE type;

type = db->type;

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

DB *db;

type = db->get_type(db);

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

DB fieldBerkeley DB 3.X method
byteswappedDB->get_byteswapped
db_errcallDB->set_errcall
db_errfileDB->set_errfile
db_errpfxDB->set_errpfx
db_paniccallDB->set_paniccall
typeDB->get_type

PrevRefNext

Copyright Sleepycat Software