Convert the tla-generated versioning info to git-generated
[sxemacs] / info / lispref / databases.texi
1 @c -*-texinfo-*-
2 @c This is part of the SXEmacs Lisp Reference Manual.
3 @c Copyright (C) 1996 Ben Wing.
4 @c Copyright (C) 2005 Sebastian Freundt <hroptatyr@sxemacs.org>
5 @c See the file lispref.texi for copying conditions.
6 @comment needs heavy extension! -hroptatyr
7 @setfilename ../../info/databases.info
8
9 @node Databases, Processes, Range Tables, top
10 @chapter Databases
11 @cindex database
12
13 @defun databasep object
14 This function returns non-@code{nil} if @var{object} is a database.
15 @end defun
16
17 @menu
18 * Connecting to a Database::
19 * Working With a Database::
20 * Other Database Functions::
21 @end menu
22
23
24 @node Connecting to a Database
25 @section Connecting to a Database
26
27 @defun open-database file &optional type subtype access mode
28 This function opens database @var{file}, using database method
29 @var{type} and @var{subtype}, with access rights @var{access} and
30 permissions @var{mode}.  @var{access} can be any combination of @code{r}
31 @code{w} and @code{+}, for read, write, and creation flags.
32
33 @var{type} can have the value @code{'dbm} or @code{'berkeley-db} to
34 select the type of database file to use.  (Note:  XEmacs may not
35 support both of these types.)
36
37 For a @var{type} of @code{'dbm}, there are no subtypes, so
38 @var{subtype} should be @code{nil}.
39
40 For a @var{type} of @code{'berkeley-db}, the following subtypes are
41 available:  @code{'hash}, @code{'btree}, and @code{'recno}.  See the
42 manpages for the Berkeley DB functions for more information about these
43 types.
44 @end defun
45
46 @defun close-database database
47 This function closes database @var{database}.
48 @end defun
49
50 @defun database-live-p object
51 This function returns @code{t} if @var{object} is an active database, else
52 @code{nil}.
53 @end defun
54
55
56 @node Working With a Database
57 @section Working With a Database
58
59 @defun get-database key database &optional default
60 This function finds the value for @var{key} in @var{database}.  If there is no
61 corresponding value, @var{default} is returned (@code{nil} if @var{default} is
62 omitted).
63 @end defun
64
65 @defun map-database function database
66 This function maps @var{function} over entries in @var{database},
67 calling it with two args, each key and value in the database.
68 @end defun
69
70 @defun put-database key value database &optional replace
71 This function stores @var{key} and @var{value} in @var{database}.
72 If optional fourth arg @var{replace} is non-@code{nil}, replace any
73 existing entry in the database.
74 @end defun
75
76 @defun remove-database key database
77 This function removes @var{key} from @var{database}.
78 @end defun
79
80
81 @node Other Database Functions
82 @section Other Database Functions
83
84 @defun database-file-name database
85 This function returns the filename associated with @var{database}.
86 @end defun
87
88 @defun database-last-error &optional database
89 This function returns the last error associated with @var{database}.
90 @end defun
91
92 @defun database-subtype database
93 This function returns the subtype of @var{database}, if any.
94 @end defun
95
96 @defun database-type database
97 This function returns the type of @var{database}.
98 @end defun