📄 open.so
字号:
m4_comment([$Id: open.so,v 11.11 2003/10/18 19:16:14 bostic Exp $])m4_ref_title(Upgrading m4_db Applications, Release 3.0: database open/close,, upgrade.3.0/dbenv, upgrade.3.0/xa)m4_p([dnlDatabase opens were changed in the m4_db 3.0 release in a similar way toenvironment opens.])m4_p([dnlTo upgrade your application, first find each place your application opensa database, that is, calls the db_open function. Each of these callsshould be replaced with calls to m4_ref(dbh_create) and m4_ref(dbh_open).])m4_p([dnlHere's an example creating a m4_db database using the 2.X interface:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret = db_open(DATABASE, DB_BTREE, DB_CREATE, 0664, dbenv, NULL, &dbp)) != 0) return (ret);])m4_p([dnlIn the m4_db 3.0 release, this code would be written as:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret = db_create(&dbp, dbenv, 0)) != 0) return (ret);m4_blankif ((ret = dbp-__GT__open(dbp, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) { (void)dbp-__GT__close(dbp, 0); return (ret);}])m4_p([dnlAs you can see, the arguments to db_open and to m4_ref(dbh_open) arelargely the same. There is some re-organization, and note that theenclosing m4_ref(DbEnv) structure is specified when the m4_ref(Db) objectis created using the m4_ref(dbh_create) function. There is oneadditional argument to m4_ref(dbh_open), argument #3. For backwardcompatibility with the 2.X m4_db releases, simply set that argument toNULL.])m4_p([dnlThere are two additional issues with the db_open call.])m4_p([dnlFirst, it was possible in the 2.X releases for an application to providean environment that did not contain a shared memory buffer pool as thedatabase environment, and m4_db would create a private one automatically.This functionality is no longer available, applications must specify them4_ref(DB_INIT_MPOOL) flag if databases are going to be opened in theenvironment.])m4_p([dnlThe final issue with upgrading the db_open call is that the DB_INFOstructure is no longer used, having been replaced by individual methodson the m4_ref(Db) handle. That change is discussed in detail later inthis chapter.])m4_page_footer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -