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
@@ -101,6 +101,7 @@ Functions:
101 101
102* Open:: Opening the database. 102* Open:: Opening the database.
103* Close:: Closing the database. 103* Close:: Closing the database.
104* Count:: Counting records in the database.
104* Store:: Inserting and replacing records in the database. 105* Store:: Inserting and replacing records in the database.
105* Fetch:: Searching records in the database. 106* Fetch:: Searching records in the database.
106* Delete:: Removing records from the database. 107* Delete:: Removing records from the database.
@@ -224,6 +225,12 @@ int gdbm_exists(dbf, key);
224char *gdbm_strerror(errno); 225char *gdbm_strerror(errno);
225int gdbm_setopt(dbf, option, value, size); 226int gdbm_setopt(dbf, option, value, size);
226int gdbm_fdesc(dbf); 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[]);
227@end example 234@end example
228 235
229The @code{gdbm.h} include file is often in the @file{/usr/local/include} 236The @code{gdbm.h} include file is often in the @file{/usr/local/include}
@@ -343,6 +350,17 @@ The pointer returned by @code{gdbm_open}.
343@end table 350@end table
344@end deftypefn 351@end deftypefn
345 352
353@node Count
354@chapter Number of Records
355@cindex number of records
356@deftypefn {gdbm interface} int gdbm_count (GDBM_FILE @var{dbf}, @
357 gdbm_count_t *@var{pcount})
358Counts number of records in the database @var{dbf}. On success,
359stores it in the memory location pointed to by @var{pcount} and return
3600. On error, sets @code{gdbm_errno} (if relevant, also @code{errno})
361and returns -1.
362@end deftypefn
363
346@node Store 364@node Store
347@chapter Inserting and replacing records in the database. 365@chapter Inserting and replacing records in the database.
348@cindex storing records 366@cindex storing records
@@ -833,6 +851,12 @@ is entirely equivalent to
833gdbm_dump(@var{dbf}, @var{exportfile}, GDBM_DUMP_FMT_BINARY, 851gdbm_dump(@var{dbf}, @var{exportfile}, GDBM_DUMP_FMT_BINARY,
834 @var{flag}, @var{mode}) 852 @var{flag}, @var{mode})
835@end example 853@end example
854
855@end deftypefn
856
857@deftypefn {gdbm interface} int gdbm_export_to_file (GDBM_FILE @var{dbf}, FILE *@var{fp})
858This is an alternative entry point to @code{gdbm_export}. This
859function writes to file @var{fp} a binary dump of the database @var{dbf}.
836@end deftypefn 860@end deftypefn
837 861
838@deftypefn {gdbm interface} int gdbm_import (GDBM_FILE @var{dbf}, @ 862@deftypefn {gdbm interface} int gdbm_import (GDBM_FILE @var{dbf}, @
@@ -847,8 +871,24 @@ following construct:
847 @var{flag} == GDBM_REPLACE ? 871 @var{flag} == GDBM_REPLACE ?
848 GDBM_WRCREAT : GDBM_NEWDB, 872 GDBM_WRCREAT : GDBM_NEWDB,
849 0600, NULL); 873 0600, NULL);
850gdbm_load (&@var{dbf}, @var{exportfile}, GDBM_DUMP_FMT_BINARY, 874gdbm_load (&@var{dbf}, @var{exportfile}, 0, @var{flag}, NULL)
851 @var{flag}, NULL) 875@end example
876@end deftypefn
877
878@deftypefn {gdbm interface} int gdbm_import_from_file (GDBM_FILE @var{dbf}, @
879 FILE *@var{fp}, int @var{flag})
880An alternative entry point to @code{gdbm_import}. Reads the binary
881dump from the file @var{fp} and stores the key/value pairs to
882@var{dbf}. @xref{Store}, for a description of @var{flag}.
883
884This function is equivalent to:
885
886@example
887@var{dbf} = gdbm_open (@var{importfile}, 0,
888 @var{flag} == GDBM_REPLACE ?
889 GDBM_WRCREAT : GDBM_NEWDB,
890 0600, NULL);
891gdbm_load_from_file (@var{dbf}, @var{fp}, @var{flag}, 0, NULL);
852@end example 892@end example
853@end deftypefn 893@end deftypefn
854 894
@@ -1894,6 +1934,12 @@ Attempting to set any other value or to unset this variable produces
1894an error. 1934an error.
1895@end deftypevr 1935@end deftypevr
1896 1936
1937@anchor{filemode}
1938@deftypevr {gdbmtool variable} number filemode
1939File mode (in octal) for creating new database files and database
1940dumps.
1941@end deftypevr
1942
1897@deftypevr {gdbmtool variable} bool lock 1943@deftypevr {gdbmtool variable} bool lock
1898Lock the database. This is the default. 1944Lock the database. This is the default.
1899 1945
@@ -2013,6 +2059,9 @@ command will not overwrite an existing file, unless the
2013determines the type of the dump (@pxref{Flat files}). By default, ASCII 2059determines the type of the dump (@pxref{Flat files}). By default, ASCII
2014dump is created. 2060dump is created.
2015 2061
2062The global variable @code{filemode} specifies the permissions to use
2063for the created output file.
2064
2016See also @ref{gdbmexport}. 2065See also @ref{gdbmexport}.
2017@end deffn 2066@end deffn
2018 2067
@@ -2081,6 +2130,8 @@ Whether or not to lock the database. Default is @samp{on}.
2081Use the memory mapping. Default is @samp{on}. 2130Use the memory mapping. Default is @samp{on}.
2082@item sync 2131@item sync
2083Synchronize after each write. Default is @samp{off}. 2132Synchronize after each write. Default is @samp{off}.
2133@item filemode
2134Specifies the permissions to use in case a new file is created.
2084@end table 2135@end table
2085 2136
2086@xref{open parameters}, for a detailed description of these variables. 2137@xref{open parameters}, for a detailed description of these variables.

Return to:

Send suggestions and report system problems to the System administrator.