aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-05-21 20:43:02 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2013-05-21 20:43:02 +0000
commit05fa76dfce5311161abbc64c12acbaf56f298e97 (patch)
tree00c6651278ded58dc53fdf1d50e601c2d469090a /doc
parent7a87cd8c3ca9528bf53cdb06dfb4168450251d79 (diff)
downloadgdbm-05fa76dfce5311161abbc64c12acbaf56f298e97.tar.gz
gdbm-05fa76dfce5311161abbc64c12acbaf56f298e97.tar.bz2
New function gdbm_count.
* configure.ac: Check for unsigned long long, define substitution variable GDBM_COUNT_T. * src/gdbmcount.c: New file. * src/Makefile.am (libgdbm_la_SOURCES): Add gdbmcount.c. * src/bucket.c (_gdbm_read_bucket_at): New function. * src/gdbm.h.in (gdbm_count_t): New typedef. (gdbm_count): New proto. * src/gdbmdefs.h (GDBM_DIR_COUNT): New define. * src/proto.h (_gdbm_read_bucket_at): New proto. * src/var.c: New variable "filemode". * src/gdbmtool.c: Use gdbm_count. Various bugfixes. * NEWS: Update. * doc/gdbm.texinfo: Update.
Diffstat (limited to 'doc')
-rw-r--r--doc/gdbm.texinfo55
1 files changed, 53 insertions, 2 deletions
diff --git a/doc/gdbm.texinfo b/doc/gdbm.texinfo
index 6353dd8..5c962d5 100644
--- a/doc/gdbm.texinfo
+++ b/doc/gdbm.texinfo
@@ -103,2 +103,3 @@ Functions:
* Close:: Closing the database.
+* Count:: Counting records in the database.
* Store:: Inserting and replacing records in the database.
@@ -226,2 +227,8 @@ int gdbm_setopt(dbf, option, value, size);
int gdbm_fdesc(dbf);
+int gdbm_export (GDBM_FILE, const char *, int, int);
+int gdbm_export_to_file (GDBM_FILE dbf, FILE *fp);
+int gdbm_import (GDBM_FILE, const char *, int);
+int gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag);
+int gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount);
+int gdbm_version_cmp (int const a[], int const b[]);
@end example
@@ -345,2 +352,13 @@ The pointer returned by @code{gdbm_open}.
+@node Count
+@chapter Number of Records
+@cindex number of records
+@deftypefn {gdbm interface} int gdbm_count (GDBM_FILE @var{dbf}, @
+ gdbm_count_t *@var{pcount})
+Counts number of records in the database @var{dbf}. On success,
+stores it in the memory location pointed to by @var{pcount} and return
+0. On error, sets @code{gdbm_errno} (if relevant, also @code{errno})
+and returns -1.
+@end deftypefn
+
@node Store
@@ -835,2 +853,8 @@ gdbm_dump(@var{dbf}, @var{exportfile}, GDBM_DUMP_FMT_BINARY,
@end example
+
+@end deftypefn
+
+@deftypefn {gdbm interface} int gdbm_export_to_file (GDBM_FILE @var{dbf}, FILE *@var{fp})
+This is an alternative entry point to @code{gdbm_export}. This
+function writes to file @var{fp} a binary dump of the database @var{dbf}.
@end deftypefn
@@ -849,4 +873,20 @@ following construct:
0600, NULL);
-gdbm_load (&@var{dbf}, @var{exportfile}, GDBM_DUMP_FMT_BINARY,
- @var{flag}, NULL)
+gdbm_load (&@var{dbf}, @var{exportfile}, 0, @var{flag}, NULL)
+@end example
+@end deftypefn
+
+@deftypefn {gdbm interface} int gdbm_import_from_file (GDBM_FILE @var{dbf}, @
+ FILE *@var{fp}, int @var{flag})
+An alternative entry point to @code{gdbm_import}. Reads the binary
+dump from the file @var{fp} and stores the key/value pairs to
+@var{dbf}. @xref{Store}, for a description of @var{flag}.
+
+This function is equivalent to:
+
+@example
+@var{dbf} = gdbm_open (@var{importfile}, 0,
+ @var{flag} == GDBM_REPLACE ?
+ GDBM_WRCREAT : GDBM_NEWDB,
+ 0600, NULL);
+gdbm_load_from_file (@var{dbf}, @var{fp}, @var{flag}, 0, NULL);
@end example
@@ -1896,2 +1936,8 @@ an error.
+@anchor{filemode}
+@deftypevr {gdbmtool variable} number filemode
+File mode (in octal) for creating new database files and database
+dumps.
+@end deftypevr
+
@deftypevr {gdbmtool variable} bool lock
@@ -2015,2 +2061,5 @@ dump is created.
+The global variable @code{filemode} specifies the permissions to use
+for the created output file.
+
See also @ref{gdbmexport}.
@@ -2083,2 +2132,4 @@ Use the memory mapping. Default is @samp{on}.
Synchronize after each write. Default is @samp{off}.
+@item filemode
+Specifies the permissions to use in case a new file is created.
@end table

Return to:

Send suggestions and report system problems to the System administrator.