aboutsummaryrefslogtreecommitdiff
path: root/doc/gdbm.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gdbm.texi')
-rw-r--r--doc/gdbm.texi2567
1 files changed, 2567 insertions, 0 deletions
diff --git a/doc/gdbm.texi b/doc/gdbm.texi
new file mode 100644
index 0000000..6322a9b
--- /dev/null
+++ b/doc/gdbm.texi
@@ -0,0 +1,2567 @@
1\input texinfo @c -*- Texinfo -*-
2@comment $Id$
3@comment %**start of header (This is for running Texinfo on a region.)
4@setfilename gdbm.info
5@include version.texi
6@settitle GDBM manual
7
8@ifinfo
9@dircategory Programming & development tools
10@direntry
11* GDBM: (gdbm). The GNU database manager.
12* gdbm_dump: (gdbm) gdbm_dump. Dump the GDBM database into a flat file.
13* gdbm_load: (gdbm) gdbm_load. Load the database from a flat file.
14@end direntry
15@end ifinfo
16
17@c @setchapternewpage odd
18@comment %**end of header (This is for running Texinfo on a region.)
19
20@c Use @kwindex for keywords
21@defcodeindex kw
22@syncodeindex kw cp
23@c Use @flindex for files
24@defcodeindex fl
25@syncodeindex fl cp
26@c Use @prindex for programs
27@defcodeindex pr
28@syncodeindex pr cp
29
30@c Merge all indices into a single one
31@syncodeindex fn cp
32@syncodeindex vr cp
33@syncodeindex ky cp
34@syncodeindex pg cp
35@syncodeindex tp cp
36
37@iftex
38@finalout
39@end iftex
40
41@copying
42Published by the Free Software Foundation,
4351 Franklin Street, Fifth Floor
44Boston, MA 02110-1301, USA
45
46Copyright @copyright{} 1989-1999, 2007-2011 Free Software Foundation, Inc.
47
48Permission is granted to copy, distribute and/or modify this document
49under the terms of the GNU Free Documentation License, Version 1.3 or
50any later version published by the Free Software Foundation; with no
51Invariant Sections, no Front-Cover, and no Back-Cover texts.
52A copy of the license is included in the section entitled ``GNU Free
53Documentation License.''
54@end copying
55
56@titlepage
57@sp 6
58@center @titlefont{GNU dbm}
59@sp 2
60@center A Database Manager
61@sp 2
62@center by Philip A. Nelson, Jason Downs and Sergey Poznyakoff
63@sp 4
64@center Manual by Pierre Gaumond, Philip A. Nelson, Jason Downs
65@center and Sergey Poznyakoff
66@sp 1
67@center Edition @value{EDITION}
68@sp 1
69@center for GNU @code{dbm}, Version @value{VERSION}
70@page
71@vskip 0pt plus 1filll
72@insertcopying
73@end titlepage
74
75@ifnothtml
76@page
77@summarycontents
78@page
79@end ifnothtml
80@contents
81
82@ifnottex
83@node Top
84@top The GNU database manager.
85
86GNU @code{dbm} is a library of functions implementing a hashed database
87on a disk file. This manual documents GNU @code{dbm} Version @value{VERSION}
88(@code{gdbm}). The software was originally written by Philip A.@:
89Nelson. This document was originally written by Pierre Gaumond from
90texts written by Phil.
91@end ifnottex
92
93@menu
94Introduction:
95
96* Copying:: Your rights.
97* Intro:: Introduction to GNU dbm.
98* List:: List of functions.
99
100Functions:
101
102* Open:: Opening the database.
103* Close:: Closing the database.
104* Count:: Counting records in the database.
105* Store:: Inserting and replacing records in the database.
106* Fetch:: Searching records in the database.
107* Delete:: Removing records from the database.
108* Sequential:: Sequential access to records.
109* Reorganization:: Database reorganization.
110* Sync:: Insure all writes to disk have competed.
111* Flat files:: Export and import to Flat file format.
112* Errors:: Convert internal error codes into English.
113* Options:: Setting internal options.
114* Locking:: File locking.
115* Variables:: Useful global variables.
116
117* Error codes:: Error codes returned by @code{gdbm} calls.
118* Compatibility:: Compatibility with UNIX dbm and ndbm.
119
120Programs
121
122* gdbmtool:: Examine and modify a GDBM database.
123* gdbm_dump:: Dump the database into a flat file.
124* gdbm_load:: Load the database from a flat file.
125* gdbmexport:: Export a database into a portable format.
126* Exit codes:: Exit codes returned by GDBM utilities.
127
128Other topics:
129
130* Bugs:: Problems and bugs.
131* Resources:: Additional resources,
132
133* GNU Free Documentation License:: Document license.
134* Index:: Index
135@end menu
136
137@node Copying
138@chapter Copying Conditions.
139This library is @dfn{free}; this means that everyone is free to use
140it and free to redistribute it on a free basis. GNU @code{dbm} (@code{gdbm})
141is not in the public domain; it is copyrighted and there
142are restrictions on its distribution, but these restrictions are
143designed to permit everything that a good cooperating citizen would want
144to do. What is not allowed is to try to prevent others from further
145sharing any version of @code{gdbm} that they might get from
146you.@refill
147
148 Specifically, we want to make sure that you have the right to give
149away copies @code{gdbm}, that you receive
150source code or else can get it if you want it, that you can change these
151functions or use pieces of them in new free programs, and that you know
152you can do these things.@refill
153
154 To make sure that everyone has such rights, we have to forbid you to
155deprive anyone else of these rights. For example, if you distribute
156copies @code{gdbm}, you must give the recipients all
157the rights that you have. You must make sure that they, too, receive or
158can get the source code. And you must tell them their rights.@refill
159
160 Also, for our own protection, we must make certain that everyone finds
161out that there is no warranty for anything in the @code{gdbm} distribution.
162If these functions are modified by someone else and passed on, we want
163their recipients to know that what they have is not what we distributed,
164so that any problems introduced by others will not reflect on our
165reputation.@refill
166
167@code{Gdbm} is currently distributed under the terms of the GNU General
168Public License, Version 3. (@emph{NOT} under the GNU General Library
169Public License.) A copy the GNU General Public License is included with
170the distribution of @code{gdbm}.
171
172@node Intro
173@chapter Introduction to GNU @code{dbm}.
174
175GNU @code{dbm} (@code{gdbm}) is a library of database functions that use
176extensible hashing and works similar to the standard UNIX @code{dbm}
177functions. These routines are provided to a programmer needing to
178create and manipulate a hashed database. (@code{gdbm} is @emph{NOT} a
179complete database package for an end user.)
180
181The basic use of @code{gdbm} is to store key/data pairs in a data file.
182Each key must be unique and each key is paired with only one data item.
183The keys can not be directly accessed in sorted order. The basic unit
184of data in @code{gdbm} is the structure:
185
186@example
187 typedef struct @{
188 char *dptr;
189 int dsize;
190 @} datum;
191@end example
192
193This structure allows for arbitrary sized keys and data items.
194
195The key/data pairs are stored in a @code{gdbm} disk file, called a
196@code{gdbm} database. An application must open a @code{gdbm} database
197to be able manipulate the keys and data contained in the database.
198@code{gdbm} allows an application to have multiple databases open at the
199same time. When an application opens a @code{gdbm} database, it is
200designated as a @code{reader} or a @code{writer}. A @code{gdbm}
201database can be opened by at most one writer at a time. However, many readers
202may open the database simultaneously. Readers and writers can not
203open the @code{gdbm} database at the same time.
204
205@node List
206@chapter List of functions.
207
208The following is a quick list of the functions contained in the @code{gdbm}
209library. The include file @code{gdbm.h}, that can be included by the user,
210contains a definition of these functions.
211
212@example
213#include <gdbm.h>
214
215GDBM_FILE gdbm_open(name, block_size, flags, mode, fatal_func);
216void gdbm_close(dbf);
217int gdbm_store(dbf, key, content, flag);
218datum gdbm_fetch(dbf, key);
219int gdbm_delete(dbf, key);
220datum gdbm_firstkey(dbf);
221datum gdbm_nextkey(dbf, key);
222int gdbm_reorganize(dbf);
223void gdbm_sync(dbf);
224int gdbm_exists(dbf, key);
225char *gdbm_strerror(errno);
226int gdbm_setopt(dbf, option, value, size);
227int gdbm_fdesc(dbf);
228int gdbm_export (GDBM_FILE, const char *, int, int);
229int gdbm_export_to_file (GDBM_FILE dbf, FILE *fp);
230int gdbm_import (GDBM_FILE, const char *, int);
231int gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag);
232int gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount);
233int gdbm_version_cmp (int const a[], int const b[]);
234@end example
235
236The @code{gdbm.h} include file is often in the @file{/usr/include}
237directory. (The actual location of @code{gdbm.h} depends on your local
238installation of @code{gdbm}.)
239
240@node Open
241@chapter Opening the database.
242
243@cindex opening the database
244@cindex database, opening or creating
245@deftypefn {gdbm interface} GDBM_FILE gdbm_open (const char *@var{name}, int @var{block_size}, @
<