icon Top 9 categories map      RocketAware > man pages >

dbm(3)

Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.


The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Home

Search all pages


Subjects

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...

    

RocketLink!--> Man page versions:



DBM(3)                    OpenBSD Programmer's Manual                   DBM(3)

NAME
     dbm, dbminit, fetch, store, delete, firstkey, nextkey, dbmclose -
     database subroutines



SYNOPSIS
     #include <dbm.h>

     int
     dbminit(const char *file);

     int
     dbmclose(void);

     datum
     fetch(datum key);

     int
     store(datum key, datum content);

     int
     delete(datum key);

     datum
     firstkey(void);

     datum
     nextkey(datum key);

DESCRIPTION
     These functions provide a dbm-compatible interface to the database access
     methods described in db(3).  Each unique record in the database is a
     key/content pair, the components of which may be any arbitrary binary da-
     ta.  The key and the content data are described by the datum data struc-
     ture:

           typedef struct {
                   char *dptr;
                   int dsize;
           } datum

     The dbminit() function is used to open a database.  Before the call to
     dbminit(), the files file.pag and file.dir must exist.  The user is re-
     sponsible for creating the zero-length .pag and .dir files.

     Once the database is open, fetch() is used to retrieve the data content
     associated with the key key. Similarly, store() is used to store the
     content data with the key key.

     The delete() function removes the key key and its associated content from
     the database.

     The functions firstkey() and nextkey() are used to iterate over all of
     the records in the database.  Each record will be reached exactly once,
     but in no particular order.  The firstkey() function returns the first
     record of the database, and thereafter nextkey() returns the following
     records.  The following code traverses the entire database:

       for (key = firstkey(); key.dptr != NULL; key = nextkey(key))

     The behaviour of nextkey() is undefined if the database is modified after
     a call to firstkey().

     The database is closed with the dbmclose() function (you must close a
     database before opening a new one).

   Implementation notes
     The underlying database is a hash(3) database with a bucket size of 4096,
     a filling factor of 40, default hashing function and cache size, and uses
     the host's native byte order.

RETURN VALUES
     Upon successful completion, all functions that return int return a value
     of 0, otherwise a negative value is returned.

     Functions that return a datum indicate errors by setting the dptr field
     to NULL.

SEE ALSO
     db(3),  hash(3),  ndbm(3)

BUGS
     Because the dbm routines are implemented on top of the db(3),  only a
     single file, file.pag, is used to actually store the database.  The ref-
     erences to file.dir are purely for backwards compatibility with historic
     implementations.

OpenBSD 2.6                    February 14, 1999                             2

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.



(Corrections, notes, and links courtesy of RocketAware.com)


[Detailed Topics]


[Overview Topics]



RocketLink!--> Man page versions:






Rapid-Links: Search | About | Comments | Submit Path: RocketAware > man pages > dbm.3/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments