DB structure
Prev | Chapter 14. Upgrading Berkeley DB 2.X applications to Berkeley DB 3.0 | Next

## 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;
    DB_TYPE type;

    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 field | Berkeley DB 3.X method
--- | ---
byteswapped | DB->get_byteswapped()
db_errcall | DB->set_errcall()
db_errfile | DB->set_errfile()
db_errpfx | DB->set_errpfx()
db_paniccall | DB->set_paniccall
type | DB->get_type()

Prev | Up | Next
db_xa_open | Home | DBINFO structure