annotate Doc/lib/libdbm.tex @ 21467:4e35fa5d5708 legacy-trunk

Add documentation for the help() built-in; contributed by Ka-Ping Yee. This is part of SF patch #494622.
author Fred Drake <fdrake@acm.org>
date Tue, 18 Dec 2001 16:31:08 +0000
parents ac583e6a3c8b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
1 \section{\module{dbm} ---
10251
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
2 Simple ``database'' interface}
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
3
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
4 \declaremodule{builtin}{dbm}
10335
093fc298afd6 "\platform{UNIX}" should really be spelled "\platform{Unix}".
Fred Drake <fdrake@acm.org>
parents: 10334
diff changeset
5 \platform{Unix}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
6 \modulesynopsis{The standard ``database'' interface, based on ndbm.}
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
7
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
10251
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
9 The \module{dbm} module provides an interface to the \UNIX{}
14607
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
10 (\code{n})\code{dbm} library. Dbm objects behave like mappings
2814
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
11 (dictionaries), except that keys and values are always strings.
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
12 Printing a dbm object doesn't print the keys and values, and the
10334
61224459bb09 Added \platform annotations.
Fred Drake <fdrake@acm.org>
parents: 10251
diff changeset
13 \method{items()} and \method{values()} methods are not supported.
2814
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
14
14607
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
15 This module can be used with the ``classic'' ndbm interface, the BSD
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
16 DB compatibility interface, or the GNU GDBM compatibility interface.
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
17 On \UNIX, the \program{configure} script will attempt to locate the
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
18 appropriate header file to simplify building this module.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
19
14607
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
20 The module defines the following:
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
21
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 \begin{excdesc}{error}
10251
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
23 Raised on dbm-specific errors, such as I/O errors.
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
24 \exception{KeyError} is raised for general mapping errors like
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
25 specifying an incorrect key.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 \end{excdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
27
14607
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
28 \begin{datadesc}{library}
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
29 Name of the \code{ndbm} implementation library used.
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
30 \end{datadesc}
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
31
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
32 \begin{funcdesc}{open}{filename\optional{, flag\optional{, mode}}}
2814
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
33 Open a dbm database and return a dbm object. The \var{filename}
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
34 argument is the name of the database file (without the \file{.dir} or
14607
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
35 \file{.pag} extensions; note that the BSD DB implementation of the
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
36 interface will append the extension \file{.db} and only create one
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
37 file).
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
38
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
39 The optional \var{flag} argument must be one of these values:
2814
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
40
14607
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
41 \begin{tableii}{c|l}{code}{Value}{Meaning}
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
42 \lineii{'r'}{Open existing database for reading only (default)}
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
43 \lineii{'w'}{Open existing database for reading and writing}
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
44 \lineii{'c'}{Open database for reading and writing, creating it if
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
45 it doesn't exist}
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
46 \lineii{'n'}{Always create a new, empty database, open for reading
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
47 and writing}
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
48 \end{tableii}
2814
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
49
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
50 The optional \var{mode} argument is the \UNIX{} mode of the file, used
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
51 only when the database has to be created. It defaults to octal
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
52 \code{0666}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 \end{funcdesc}
10521
f005ac735863 Added more "See also" entries, + 1 inline hyperlink.
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
54
f005ac735863 Added more "See also" entries, + 1 inline hyperlink.
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
55
f005ac735863 Added more "See also" entries, + 1 inline hyperlink.
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
56 \begin{seealso}
f005ac735863 Added more "See also" entries, + 1 inline hyperlink.
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
57 \seemodule{anydbm}{Generic interface to \code{dbm}-style databases.}
14607
ac583e6a3c8b Add some comments on the available implementations that this module can
Fred Drake <fdrake@acm.org>
parents: 10521
diff changeset
58 \seemodule{gdbm}{Similar interface to the GNU GDBM library.}
10521
f005ac735863 Added more "See also" entries, + 1 inline hyperlink.
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
59 \seemodule{whichdb}{Utility module used to determine the type of an
f005ac735863 Added more "See also" entries, + 1 inline hyperlink.
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
60 existing database.}
f005ac735863 Added more "See also" entries, + 1 inline hyperlink.
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
61 \end{seealso}