⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fop.so

📁 berkeley db 4.6.21的源码。berkeley db是一个简单的数据库管理系统
💻 SO
字号:
m4_comment([$Id: fop.so,v 1.8 2004/08/13 03:39:01 bostic Exp $])m4_ref_title(Upgrading m4_db Applications,[Release 4.1: DB-__GT__associate, DB-__GT__open, DB-__GT__remove, DB-__GT__rename],,    upgrade.4.1/excl, upgrade.4.1/log_register)m4_p([dnlHistoric releases of m4_db transaction-protected the m4_ref(dbh_open),m4_ref(dbh_remove) and m4_refT(dbh_rename)s, but did it in an implicitway, that is, applications did not specify the m4_ref(DbTxn) handlesassociated with the operations.  This approach had a number of problems,the most significant of which was there was no way to group operationsthat included database creation, removal or rename.  For example,applications wanting to maintain a list of the databases in anenvironment in a well-known database had no way to update the well-knowndatabase and create a database within a single transaction, and so therewas no way to guarantee the list of databases was correct for theenvironment after system or application failure. Another example mightbe the creation of both a primary database and a database intended toserve as a secondary index, where again there was no way to group thecreation of both databases in a single atomic operation.])m4_p([dnlIn the 4.1 release of m4_db, this is no longer the case.  Them4_ref(dbh_open) and m4_refT(dbh_associate)s now take a m4_ref(DbTxn)handle returned by m4_ref(txn_begin) as an optional argument.  Newm4_ref(dbenv_dbremove) and m4_refT(dbenv_dbrename)s taking am4_ref(DbTxn) handle as an optional argument have been added.])m4_p([dnlTo upgrade, applications must add a m4_ref(DbTxn) parameter in theappropriate location for the m4_refT(dbh_open) calls, and them4_refT(dbh_associate) calls (in both cases, the second argument forthe C API, the first for the C++ or Java APIs).])m4_p([dnlApplications wanting to transaction-protect their m4_ref(dbh_open) andm4_ref(dbh_associate) method calls can add a NULL m4_ref(DbTxn)argument and specify the m4_ref(DB_AUTO_COMMIT) flag to the two calls,which wraps the operation in an internal m4_db transaction.Applications wanting to transaction-protect the remove and renameoperations must rewrite their calls to the m4_ref(dbh_remove) andm4_refT(dbh_rename)s to be, instead, calls to the newm4_ref(dbenv_dbremove) and m4_refT(dbenv_dbrename)s.  Applications notwanting to transaction-protect any of the operations can add a NULLargument to their m4_ref(dbh_open) and m4_refT(dbh_associate) calls andrequire no further changes.])m4_p([dnlFor example, an application currently opening and closing a database asfollows:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret = db_create(&dbp, dbenv, 0)) != 0)	goto err_handler;m4_blankif ((ret = dbp-__GT__open(dbp, "file", NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {	(void)dbp-__GT__close(dbp);	goto err_handler;}])m4_p([dnlcould transaction-protect the m4_ref(dbh_open) call as follows:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret = db_create(&dbp, dbenv, 0)) != 0)	goto err_handler;m4_blankif ((ret = dbp-__GT__open(dbp,    NULL, "file", NULL, DB_BTREE, DB_CREATE | DB_AUTO_COMMIT, 0664)) != 0) {	(void)dbp-__GT__close(dbp);	goto err_handler;}])m4_p([dnlAn application currently removing a database as follows:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret = db_create(&dbp, dbenv, 0)) != 0)	goto err_handler;m4_blankif ((ret = dbp-__GT__remove(dbp, "file", NULL, 0)) != 0)	goto err_handler;])m4_p([dnlcould transaction-protect the database removal as follows:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret =    dbenv-__GT__dbremove(dbenv, NULL, "file", NULL, DB_AUTO_COMMIT)) != 0)	goto err_handler;])m4_p([dnlAn application currently renaming a database as follows:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret = db_create(&dbp, dbenv, 0)) != 0)	goto err_handler;m4_blankif ((ret = dbp-__GT__rename(dbp, "file", NULL, "newname", 0)) != 0)	goto err_handler;])m4_p([dnlcould transaction-protect the database renaming as follows:])m4_indent([dnlDB *dbp;DB_ENV *dbenv;int ret;m4_blankif ((ret = dbenv-__GT__dbrename(    dbenv, NULL, "file", NULL, "newname", DB_AUTO_COMMIT)) != 0)	goto err_handler;])m4_p([dnlThese examples are the simplest possible translation, and will result inbehavior matching that of previous releases.  For further discussion onhow to transaction-protect m4_refT(dbh_open) calls, seem4_link(M4RELDIR/ref/transapp/data_open, Opening the databases).])m4_p([dnlm4_ref(Db) handles that will later be used for transaction-protectedoperations must be opened within a transaction.  Specifying atransaction handle to operations using handles not opened within atransaction will return an error.  Similarly, not specifying atransaction handle to operations using handles that were opened withina transaction will also return an error.])m4_page_footer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -