Init must be called before any other function in the module.
Each logical database is represented by a Db value. It can span several physical files, named in the body of a database attribute in the primary file of the database. (If no such attribute appears, there is just the one physical file in the database.)
Db.open( path ) Opens path as a database, and returns a (reference to a) Db value that represents it. On an error, it returns nil and the system error string contains a diagnostic. If path contains a database attribute with associated attributes of the form file= filename, the logical database is formed by (logically) concatenating the contents of each filename in the order listed. See attrdb (6) for details.
Db.sopen( data ) Treat the contents of the string data as a database, and return a Db value representing it.
db1 .append( db2 ) Return a Db value that represents the result of logically appending the contents of database db2 to db1 .
db .changed() Return true iff one or more of the underlying files have changed since they were last read.
db .reopen() Discard any cached data, and reopen the database files. Return 0 on success but -1 if any file could not be reopened.
db .find( ptr , attr ) Starting at ptr , look in db for the next entry that contains an attribute attr and return a tuple ( e , ptr ) where e is a Dbentry value representing the whole entry, and ptr is a database pointer for the next entry. If attr cannot be found, e is nil.
db .findpair( ptr, attr, value) Starting at ptr , look in db for the next entry that contains the pair attr = value, and return a tuple ( e , ptr ) where e is a Dbentry value representing the whole entry, and ptr is a database pointer for the next entry. If the given pair cannot be found, e is nil.
db .findbyattr( ptr, attr, value, rattr ) Starting at ptr in db , look for the next entry containing both the pair attr = value and a pair with attribute rattr ; return a tuple ( e , ptr ) where e is a Dbentry value representing the whole entry, and ptr is a database pointer for the next entry. If no such entry can be found, e is nil.
Parseline takes a line containing a set of space-separated attribute = value pairs, and returns a tuple ( ts , err ) . If the line's syntax is correct, ts is a Tuples value that represents the pairs as a list of Attr values. If the syntax is wrong (eg, unmatched quote), ts is nil and err contains a diagnostic.