Libht has a fairly simple minded interface to MSQL, a relational database manager. 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...
- int hminit (char * host, char * db)
- hrec * hmfind (int sock, hrec * hr, char * table, char * field, char * val)
- hrec * hmfindf (int sock, hrec * hr, char * table, char * fmt, ...)
- int hmfetchrows (int sock, hrec * hr, char * table, void ** ctx)
- int hmfetchrowsf (int sock, hrec * hr, char * table, void ** ctx, char * fmt, ...)
- int hmmax (int sock, char * table, char * field)
- char * slashify (char * str)
- int hmupdate (int sock, hrec * hr, char * table, char * field, char * val)
- int hmupdatef (int sock, hrec * hr, char * table, char * fmt, ...)
- int hminsert (int sock, hrec * hr, char * table)
- int hmdelete (int sock, char * table, char * field, char * val)
- int msqlQueryf (int sock, char * fmt, ...)
- int hminit (char * host, char * db)
- Start access to the database db on host host. If host is null or an empty string, it defaults to the localhost.
- hrec * hmfind (int sock, hrec * hr, char * table, char * field, char * val)
- Given the hrec, fetch the record where field is equal to val. If there is more than one row, the first is used and the rest are ignored. If the field value is null, there will be no "where" clause on the query.
- hrec * hmfindf (int sock, hrec * hr, char * table, char * fmt, ...)
- Like hmfind, but with a printf(3) like interface to produce the query clause. This is a standard SQL select clause.
- int hmfetchrows (int sock, hrec * hr, char * table, void ** ctx)
- hmfetchrows has the ability to fetch multiple rows from a database. To start the query, set the context pointer to zero. 1 is returned if there is a row, -1 on error, 0 for no more rows.
- int hmfetchrowsf (int sock, hrec * hr, char * table, void ** ctx, char * fmt, ...)
- Like hmfetchrows, but has a printf(3) like interface to make a more complex query.
- int hmmax (int sock, char * table, char * field)
- Find the integer maximum for field
- char * slashify (char * str)
- slashify a buffer in SQL parlance. The result is placed in a static buffer which will be overwritten on subsequent calls.
- int hmupdate (int sock, hrec * hr, char * table, char * field, char * val)
- hmupdate updates the row where field equals val. 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 hminsert().
- int hmupdatef (int sock, hrec * hr, char * table, char * fmt, ...)
- Same as hmupdate, but all the user control over the where clause in the update query. Uses a standard printf(3) interface.
- int hminsert (int sock, hrec * hr, char * table)
- Insert a row into table given the contents hr. No attempt is made to update any previous row.
© (copyright) 1997 MTCC Last modified: Sat May 3 10:03:48 PDT 1997