@@ -7,32 +7,45 @@ \section{\module{dbm} ---
77
88
99The \module {dbm} module provides an interface to the \UNIX {}
10- \code {(n) dbm} library. Dbm objects behave like mappings
10+ ( \code {n}) \code { dbm} library. Dbm objects behave like mappings
1111(dictionaries), except that keys and values are always strings.
1212Printing a dbm object doesn't print the keys and values, and the
1313\method {items()} and \method {values()} methods are not supported.
1414
15- See also the \refmodule {gdbm}\refbimodindex {gdbm} module, which
16- provides a similar interface using the GNU GDBM library.
15+ This module can be used with the `` classic'' ndbm interface, the BSD
16+ DB compatibility interface, or the GNU GDBM compatibility interface.
17+ On \UNIX , the \program {configure} script will attempt to locate the
18+ appropriate header file to simplify building this module.
1719
18- The module defines the following constant and functions :
20+ The module defines the following:
1921
2022\begin {excdesc }{error}
2123Raised on dbm-specific errors, such as I/O errors.
2224\exception {KeyError} is raised for general mapping errors like
2325specifying an incorrect key.
2426\end {excdesc }
2527
26- \begin {funcdesc }{open}{filename, \optional {flag, \optional {mode}}}
28+ \begin {datadesc }{library}
29+ Name of the \code {ndbm} implementation library used.
30+ \end {datadesc }
31+
32+ \begin {funcdesc }{open}{filename\optional {, flag\optional {, mode}}}
2733Open a dbm database and return a dbm object. The \var {filename}
2834argument is the name of the database file (without the \file {.dir} or
29- \file {.pag} extensions).
35+ \file {.pag} extensions; note that the BSD DB implementation of the
36+ interface will append the extension \file {.db} and only create one
37+ file).
38+
39+ The optional \var {flag} argument must be one of these values:
3040
31- The optional \var {flag} argument can be
32- \code {'r'} (to open an existing database for reading only --- default),
33- \code {'w'} (to open an existing database for reading and writing),
34- \code {'c'} (which creates the database if it doesn't exist), or
35- \code {'n'} (which always creates a new empty database).
41+ \begin {tableii }{c|l}{code}{Value}{Meaning}
42+ \lineii {'r'}{Open existing database for reading only (default)}
43+ \lineii {'w'}{Open existing database for reading and writing}
44+ \lineii {'c'}{Open database for reading and writing, creating it if
45+ it doesn't exist}
46+ \lineii {'n'}{Always create a new, empty database, open for reading
47+ and writing}
48+ \end {tableii }
3649
3750The optional \var {mode} argument is the \UNIX {} mode of the file, used
3851only when the database has to be created. It defaults to octal
@@ -42,6 +55,7 @@ \section{\module{dbm} ---
4255
4356\begin {seealso }
4457 \seemodule {anydbm}{Generic interface to \code {dbm}-style databases.}
58+ \seemodule {gdbm}{Similar interface to the GNU GDBM library.}
4559 \seemodule {whichdb}{Utility module used to determine the type of an
4660 existing database.}
4761\end {seealso }
0 commit comments