GNU Database Manager


The gdbm vocabulary provides an interface to GNU DataBase Manager. This is a GNU implementation of the standard Unix dbm library, originally developed at Berkeley.

This is a very brief manual. For a more detailed description consult the official gdbm documentation.

Basics
All interaction with gdbm database should be realized using special combinator which automates all work for database initialisation and cleanup. All initialisation options are passed to combinator with a database configuration object.
gdbm

<gdbm> ( -- gdbm )

with-gdbm ( gdbm quot -- )


For actual record manipulation the following words are used:
insert ( key content -- )

exists? ( key -- ? )

fetch ( key -- content/f )

delete ( key -- )


Sequential access
It is possible to iterate through all records in the database with
first-key ( -- key/f )

next-key ( key -- key/f )


The following combinators, however, provide more convenient way to do that:
each-key ( ... quot: ( ... key -- ... ) -- ... )

each-value ( ... quot: ( ... value -- ... ) -- ... )

each-record ( ... quot: ( ... key value -- ... ) -- ... )


The order in which records are accessed has nothing to do with the order in which records have been stored. Note that these words can only be used in read-only algorithms since delete operation re-arranges the hash table.