DBM Database Interface

Libht has a fairly simple minded interface to DBM, the boneheadedly stupid standard database manager on most Unix platforms. It retrieves and stores datasets based on hrecs. The fields in the hrec directly correspond to the fields in the database giving a very simple conduit from database to program and back out to the form through htbindform().

This module could use more work on the flexibility front, and it eventually would be nice to standardize on an interface which smooths over the eccentricities of the various database managers out there, but since I dunna have access to Oracle, say, this is still to be done...

hrec * hdbminit (char * db)

Initialize access to DBM

hrec * hdbmfind (char * key, hrec * hr)

Given the hrec, fetch the record for key If there is more than one row, the first is used and the rest are ignored.

hrec * hdbmfetchrows (hrec * hr, void * ctx)

hdbmfetchrows has the ability to fetch multiple rows from a database. To start the query, set the context pointer to zero.

int hdbmmax (char * field)

Find the integer maximum for field

int hdbmupdate (char * key, hrec * hr)

hdbmupdate updates the record at key. All of the unhidden fields in the hrec are updated. This function will either replace an existing row, or created a new row if necessary. If you want to just insert a new row, consider hdbminsert().

int hdbminsert (char * key, hrec * hr)

Insert a record into the database given the contents hr.

int hdbmdelete (char * key)

hdbmdelete delete's the record which matches key


© (copyright) 1997 MTCC
Last modified: Fri Apr 25 20:20:14 PDT 1997