DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Berkeley DB Reference Guide:
Upgrading Berkeley DB Applications

PrevRefNext

Release 3.0: the DBINFO structure

The DB_INFO structure has been removed from the Berkeley DB 3.0 release. Accesses to any fields within that structure by the application should be replaced with method calls on the DB handle. The following example illustrates this using the historic db_cachesize structure field. In the Berkeley DB 2.X releases, applications could set the size of an underlying database cache using code similar to the following:

DB_INFO dbinfo;

memset(dbinfo, 0, sizeof(dbinfo)); dbinfo.db_cachesize = 1024 * 1024;

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

DB *db;
int ret;

ret = db->set_cachesize(db, 0, 1024 * 1024, 0);

The DB_INFO structure is no longer used in any way by the Berkeley DB 3.0 release, and should be removed from the application.

The following table lists the DB_INFO fields previously used by applications and the methods that should now be used to set them. Because these calls provide configuration for the database open, they must precede the call to DB->open. Calling them after the call to DB->open will return an error.

DB_INFO fieldBerkeley DB 3.X method
bt_compareDB->set_bt_compare
bt_minkeyDB->set_bt_minkey
bt_prefixDB->set_bt_prefix
db_cachesizeDB->set_cachesize

Note: the DB->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.

db_lorderDB->set_lorder
db_mallocDB->set_malloc
db_pagesizeDB->set_pagesize
dup_compareDB->set_dup_compare
flagsDB->set_flags

Note: the DB_DELIMITER, DB_FIXEDLEN and DB_PAD flags no longer need to be set as there are specific methods off the DB handle that set the file delimiter, the length of fixed-length records and the fixed-length record pad character. They should simply be discarded from the application.

h_ffactorDB->set_h_ffactor
h_hashDB->set_h_hash
h_nelemDB->set_h_nelem
re_delimDB->set_re_delim
re_lenDB->set_re_len
re_padDB->set_re_pad
re_sourceDB->set_re_source

PrevRefNext

Copyright (c) 1996-2005 Sleepycat Software, Inc. - All rights reserved.