Database Engine and API's

The database engine built by Future Lab is called Bbuuzzb. The engine is based on typeless string data with variable field and record size. Any number of fields may be present in the record and records may have a different number of fields.

The database engine uses special characters to delimit records and fields. Here are the delimiters used by the database engine:

The above list starts with a description of the database delimiter, the define (in dbeng.h) and the actual ASCII character code.

In principle, there is no limit to the size of a record/field (except for the DOS platform were there is a 32000 byte record/field limit) but, to keep things simple, I have imposed a 64000 byte record/field limit.

Each database table represents one physical OS file. The database engine does not use container files. The physical structure of each data file is a series of records with each record delimited by the record delimiter. Each field within the record is delimited by the field delimiter. At the beginning of each record there is a 12 byte record header consisting of:

   A|DnnnnnnnnnnFM

Where the first byte of the record header is either A for an active record or D for a record marked for deletion. The next 10 bytes (denoted above by nnnnnnnnnn) consists of the length of the record in question. Note that since all engine data is string based, the length is also stored in character form. The last byte of the record header (denoted above by FM) is the field mark.

Access to the data table by the engine is sequential. At the moment, there is no provision for sorting or indexes. When a record is re-written, the old record is marked for deletion and a new record is written. New records are always written to the end of the table. As the table builds the number of records marked for deletion, the pack function should be run against the specific table.

The database engine has no concept of a key field. The notion of a key field must be imposed by the developer. Since there is no key field concept, duplicates are allowed in any field. Duplicate key detection and handling must be handled by the developer.

The database engine relies on the word parsing abilities in the library module parse.c. The database engine and API's also depend on the database header files. In the Unix platform, the database modules can be compiled using the script cdbeng.

The database API is divided into low level and high level modules. The low level consists of the engine itself in the module dbeng.c. There are two versions of the high level API, one for stand-alone applications (in the file dblocal.c) and one for client/server applications (in the file dbcs.c). The high level database API modules are based on database tids which uniquely identify the table instance.

The database engine also contains configuration options specified in the database configuration file.

Database Modules

Dbcs.c

This module is the high level client/server database API. The functions in this module build a command string and send this information to the database server. A reply code and any returned value from the database server is accepted upon return.

Dbcscfg.c

This module is the high level client/server database configuration API. This module consists of various get and set functions to deal with database configuration items.

Dbeng.c

This module is the low level database engine. All engine operations that deal with file I/O are contained within this module. The functions in this module are intended to be called only by other functions in the module or by functions in the stand-alone database API module (in the file dblocal.c). Your database applications should always use the high level database API.

Dbengcfg.c

This module is used to manage low level database configuration details. The functions in this module are intended to be called only by other functions in the module or by functions in the database engine module (in the file dbeng.c) or by functions in the high level stand-alone database configuration API (in the file dblocfg.c).

Dbiocode.c

This module contains functions to translate Bbuuzzb engine codes to an English phrase. The module contains functions at both the dbeng low level and the db high level. This module must be linked into every application that uses the stand-alone engine (dbeng.c and dblocal.c) or the client/server database API (dbcs.c).

Dblocal.c

This module is the high level stand-alone API for the Bbuuzzb engine. Every application that uses the stand-alone version of the database engine must link with this module.

Dblocfg.c

This module is the high level stand-alone API for the Bbuuzzb engine configuration details. Every application that uses the stand-alone version of the database engine must link with this module.

Goto Top | Future Lab Home | Contact Webmaster | Feedback

Copyright © 1999 Future Lab Inc., Last Updated Aug 23, 1999