dbm - dbm interface

Module Description

The dbm module implements a dbm database. It implements words to open, fetch, write, iterate and close a dbm database file. The database file is compatible with the samba's TDB database. Due to the absence of file locking and mmap words in the ANS standard, there is no locking or mmap support for the TDB database. There is also no support for endian conversion. The in memory dbm is supported. See [http://sourceforge.net/projects/tdb/ tdb's home] for more info.

Module Words

dbm structure

dbm% ( -- n )
Get the required space for a dbm variable

Database variable creation, initialisation and destruction

dbm-init ( dbm -- )
Initialise the dbm variable
dbm-(free) ( dbm -- )
Free the private dynamic variables from the heap
dbm-create ( "<spaces>name" -- ; -- dbm )
Create a dbm variable in the dictionary
dbm-new ( n -- car )
Allocate a dbm variable on the heap
dbm-free ( car -- )
Free the dbm variable from the heap

Module words

dbm+hash ( c-addr u -- +n )
Calculate the hash used in the dbm files

Dbm open constants

dbm.default ( -- n )
Open flag: Default open mode
dbm.clear ( -- n )
Open flag: Clear an existing database
dbm.internal ( -- n )
Open flag: Build database in memory

Dbm store constants

dbm.replace ( -- n )
Store flag for replace data, also if key is already present
dbm.insert ( -- n )
Store flag for only inserting data, error if key is already present
dbm.modify ( -- n )
Store flag for only modifing data, no increase of data allowed

Database words

dbm-open ( c-addr u +n1 n2 dbm -- ior )
Open or create a dbm file with name c-addr u, block size n1 and flags n2
dbm-fetch ( c-addr u dbm -- c-addr u ior )
Fetch data from the dbm file with key c-addr u
dbm-exist ( c-addr u dbm -- flag ior )
Check if the key c-addr u exists in the dbm file
dbm-store ( c-addr1 u1 c-addr2 u2 n dbm -- ior )
Store data in the dbm file with key c-addr2 u2, data c-addr1 u1 and flags n
dbm-delete ( c-addr u dbm -- flag ior )
Delete the key c-addr u from the dbm file
dbm-first-key ( dmb -- c-addr u ior )
Get the first key from the dbm file
dbm-next-key ( dbm -- c-addr u ior )
Get the next key from the dbm file
dbm-close ( dbm -- ior )
Close the dbm file

Inspection

dbm-dump-freelist ( dbm -- )
Dump the freelist
dbm-dump ( dbm -- )
Dump the dbm variable

generated 28-Mar-2010 by ofcfrth-0.10.0