| THE META-HTML LANGUAGE REFERENCE MANUAL

Dynamic Modules | [TOC] | Odbc Database Operators

## Section Intro: Direct Dbm Access

Synopsis:

There are times when it is desirable to directly access DBM, NDBM, or GDBM databases, for example, when reading or writing values to a database created with a different tool, such as Perl or TCL.

Meta-HTML provides low-level access primitives for such databases in addition to a higher-level, more generally useful abstraction (which is detailed in Database Commands.

Commands:

dbm::first-key dbm::get-var | dbm::next-key dbm::set-var | dbm::unset-var dbm::with-open-database

### Function Documentation

`<dbm::first-key DBVAR>` | Simple

Returns the "first" key in the database referenced by DBVAR.

`<dbm::get-var DBVAR VARNAME>` | Simple

Returns the value associated with VARNAME in the open database referenced by DBVAR.

`<dbm::next-key DBVAR AFTERKEY>` | Simple

Returns the "next" key in the database referenced by DBVAR starting after the key AFTERKEY.

`<dbm::set-var DBVAR [NAME=VALUE...]>` | Simple

Sets the association for NAME to be VALUE in the open database referenced by DBVAR. Multiple NAME=VALUE pairs may be given.

`<dbm::unset-var DBVAR>` | Simple

Deletes any association for NAME in the open database referenced by DBVAR.

`<dbm::with-open-database DBVAR DBNAME [MODE=OPEN-MODE]> body </dbm::with-open-database>` | Complex

Create an environment in which other database commands can be given. First, the database referenced by DBNAME is locked and opened in the mode specified by OPEN-MODE, and the resultant database handle is bound to the variable named by DBVAR. Then, the BODY code is executed. Finally, the database is closed, and further references to DBVAR are meaningless.

Please note that the file name specified by DBNAME should be a full pathname; it is not relative to Web space in any way.

Only the DBM commands are meaningful within this environment. This function is designed to allow access to legacy dbm, gdbm, or ndbm databases; it won't work on anything else.

OPEN-MODE should evaluate to one of the following:

- READER
  The caller wishes only to have read access to the specified database.

- WRITER
  The caller wishes to have both read and write access to the specified database.

- WRITE-CREATE
  The caller wishes both read and write access to the specified database. If the database does not exist, it is created.

Edit Section
Function Index
Variable Index

The META-HTML Reference Manual V1.4 Copyright © 1995, 1996, Brian J. Fox, 1996, 1997 Universal Access Inc.
Found a bug? Send mail to bug-manual@metahtml.com