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
9 @node Databases, Processes, Range Tables, top
13 @defun databasep object
14 This function returns non-@code{nil} if @var{object} is a database.
18 * Connecting to a Database::
19 * Working With a Database::
20 * Other Database Functions::
24 @node Connecting to a Database
25 @section Connecting to a Database
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.
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.)
37 For a @var{type} of @code{'dbm}, there are no subtypes, so
38 @var{subtype} should be @code{nil}.
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
46 @defun close-database database
47 This function closes database @var{database}.
50 @defun database-live-p object
51 This function returns @code{t} if @var{object} is an active database, else
56 @node Working With a Database
57 @section Working With a Database
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
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.
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.
76 @defun remove-database key database
77 This function removes @var{key} from @var{database}.
81 @node Other Database Functions
82 @section Other Database Functions
84 @defun database-file-name database
85 This function returns the filename associated with @var{database}.
88 @defun database-last-error &optional database
89 This function returns the last error associated with @var{database}.
92 @defun database-subtype database
93 This function returns the subtype of @var{database}, if any.
96 @defun database-type database
97 This function returns the type of @var{database}.