m4_comment([$Id: db_cxx.so,v 11.9 2000/03/22 22:02:14 bostic Exp $]) m4_ref_title(Upgrading m4_db Applications, Release 3.0: the Db class for C++ and Java,, upgrade.3.0/dbenv_cxx, upgrade.3.0/cxx) m4_p([dnl The static Db::open method and the DbInfo class have been removed in the m4_db 3.0 release. The way to open a database file is to use the new Db constructor with two arguments, followed by set_XXX methods to configure the Db object, and finally a call to the new (nonstatic) Db::open(). In comparing the m4_db 3.0 release open method with the 2.X static open method, the second argument is new. It is a database name, which can be null. The DbEnv argument has been removed, as the environment is now specified in the constructor. The open method no longer returns a Db, since it operates on one.]) m4_p([dnl Here's a C++ example opening a m4_db database using the 2.X interface:]) m4_indent([dnl // Note: by default, errors are thrown as exceptions Db *table; Db::open("lookup.db", DB_BTREE, DB_CREATE, 0644, dbenv, 0, &table);]) m4_p([dnl In the m4_db 3.0 release, this code would be written as:]) m4_indent([dnl // Note: by default, errors are thrown as exceptions Db *table = new Db(dbenv, 0); table-__GT__open("lookup.db", NULL, DB_BTREE, DB_CREATE, 0644);]) m4_p([dnl Here's a Java example opening a m4_db database using the 2.X interface:]) m4_indent([dnl // Note: errors are thrown as exceptions Db table = Db.open("lookup.db", Db.DB_BTREE, Db.DB_CREATE, 0644, dbenv, 0);]) m4_p([dnl In the m4_db 3.0 release, this code would be written as:]) m4_indent([dnl // Note: errors are thrown as exceptions Db table = new Db(dbenv, 0); table.open("lookup.db", null, Db.DB_BTREE, Db.DB_CREATE, 0644);]) m4_p([dnl Note that if the dbenv argument is null, the database will not exist within an environment.]) m4_page_footer