📄 opensub.so
字号:
m4_comment([$Id: opensub.so,v 10.20 2007/05/17 18:31:55 bostic Exp $])m4_ref_title(Access Methods, Opening multiple databases in a single file,, am/open, am/get)m4_p([dnlApplications may create multiple databases within a single physicalfile. This is useful when the databases are both numerous andreasonably small, in order to avoid creating a large number ofunderlying files, or when it is desirable to include secondary indexdatabases in the same file as the primary index database. Puttingmultiple databases in a single physical file is an administrativeconvenience and unlikely to affect database performance.])m4_p([dnlTo open or create a file that will include more than a single database,specify a database name when calling the m4_ref(dbh_open) method.])m4_p([dnlPhysical files do not need to be comprised of a single type of database,and databases in a file may be of any mixture of types, except for Queuedatabases. Queue databases must be created one per file and cannotshare a file with any other database type. There is no limit on thenumber of databases that may be created in a single file other than thestandard m4_db file size and disk space limitations.])m4_p([dnlIt is an error to attempt to open a second database in a file that wasnot initially created using a database name, that is, the file mustinitially be specified as capable of containing multiple databases for asecond database to be created in it.])m4_p([dnlIt is not an error to open a file that contains multiple databaseswithout specifying a database name, however the database type should bespecified as DB_UNKNOWN and the database must be opened read-only. Thehandle that is returned from such a call is a handle on a database whosekey values are the names of the databases stored in the database fileand whose data values are opaque objects. No keys or data values may bemodified or stored using this database handle.])m4_section([Configuring databases sharing a file])m4_p([dnlThere are four pieces of configuration information which must bespecified consistently for all databases in a file, rather thandiffering on a per-database basis. They are: byte order, checksum andencryption behavior, and page size. When creating additional databasesin a file, any of these configuration values specified must beconsistent with the existing databases in the file or an error will bereturned.])m4_section([Caching databases sharing a file])m4_p([dnlWhen storing multiple databases in a single physical file rather thanin separate files, if any of the databases in a file is opened forupdate, all of the databases in the file must share a memory pool. Inother words, they must be opened in the same database environment. Thisis so per-physical-file information common between the two databases isupdated correctly.])m4_section([Locking in databases based on sharing a file])m4_p([dnlIf databases are in separate files (and access to each separate databaseis single-threaded), there is no reason to perform any locking of anykind, and the two databases may be read and written simultaneously.Further, there would be no requirement to create a shared databaseenvironment in which to open those two databases.])m4_p([dnlHowever, since multiple databases in a file exist in a single physicalfile, opening two databases in the same file simultaneously requireslocking be enabled, unless all of the databases are read-only. As thelocks for the two databases can only conflict during page allocation,this additional locking is unlikely to affect performance. Theexception is when m4_cam is configured; a single lock is used for alldatabases in the file when m4_cam is configured, and a write to onedatabase will block all accesses to all databases.])m4_p([dnlIn summary, programmers writing applications that open multipledatabases in a single file will almost certainly need to create a shareddatabase environment in the application as well. For more informationon database environments, see m4_link(M4RELDIR/ref/env/intro, [Databaseenvironment introduction.])])m4_page_footer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -