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

📄 put.so

📁 berkeley db 4.6.21的源码。berkeley db是一个简单的数据库管理系统
💻 SO
字号:
m4_comment([$Id: put.so,v 1.11 2003/10/18 19:16:15 bostic Exp $])m4_ref_title(Upgrading m4_db Applications,    Release 3.1: DB-__GT__put,,    upgrade.3.1/set_paniccall, upgrade.3.1/dup)m4_p([dnlFor the Queue and Recno access methods, when the m4_ref(DB_APPEND) flagis specified to the m4_refT(dbh_put), the allocated record number isreturned to the application in the m4_arg(key) m4_ref(Dbt) argument.  Inprevious releases of m4_db, this m4_ref(Dbt) structure did not followthe usual m4_ref(Dbt) conventions.  For example, it was not possible tocause m4_db to allocate space for the returned record number.  Rather,it was always assumed that the m4_arg(data) field of the m4_arg(key)structure referred to memory that could be used as storage for adb_recno_t type.])m4_p([dnlAs of the m4_db 3.1.0 release, the m4_arg(key) structure behaves asdescribed in the m4_ref(Dbt) C++/Java class or C structure documentation.])m4_p([dnlApplications which are using the m4_ref(DB_APPEND) flag for Queue andRecno access method databases will require a change to upgrade to them4_db 3.1 releases.  The simplest change is likely to be to add them4_ref(DB_DBT_USERMEM) flag to the m4_arg(key) structure.  For example,code that appears as follows:])m4_indent([dnlDBT key;db_recno_t recno;m4_blankmemset(&key, 0, sizeof(DBT));key.data = &recno;key.size = sizeof(recno);DB-__GT__put(DB, NULL, &key, &data, DB_APPEND);printf("new record number is %lu\n", (u_long)recno);])m4_p([would be changed to:])m4_indent([dnlDBT key;db_recno_t recno;m4_blankmemset(&key, 0, sizeof(DBT));key.data = &recno;key.ulen = sizeof(recno);key.flags = DB_DBT_USERMEM;DB-__GT__put(DB, NULL, &key, &data, DB_APPEND);printf("new record number is %lu\n", (u_long)recno);])m4_p([dnlNote that the m4_arg(ulen) field is now set as well as the flag value.An alternative change would be:])m4_indent([dnlDBT key;db_recno_t recno;m4_blankmemset(&key, 0, sizeof(DBT));DB-__GT__put(DB, NULL, &key, &data, DB_APPEND);recno = *(db_recno_t *)key-__GT__data;printf("new record number is %lu\n", (u_long)recno);])m4_page_footer

⌨️ 快捷键说明

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