Database Header Files

The following header files are used by the Future Lab database modules:

# Dbcomm.h

This header contains defines for the database command codes. These command codes are not used by the database engine but are used by database applications that use command keywords.

# Dbcs.h

This header contains function prototypes for the database module dbcs.c.

# Dbcscfg.h

This header contains function prototypes for the database module dbcscfg.c.

# Dbeng.h

This is the main database engine header. It contains various defines including the maximum record/field size and database delimiters.

Function prototypes for the database module dbeng.c are also contained in this header.

The definition of the table structure dbeng_table is also contained in this header.

## dbeng_table Structure

    struct dbeng_table
       {
       struct dbeng_table *next;           /* pointer to next table */
       FILE *handle;                       /* file handle */
       char *rec;                          /* current record contents */
       char *name;                         /* physical file name */
       int tid;                            /* assigned table ID */
       int change_rec_flag;                /* has current record changed? */
       int enforce_change_rec_flag;        /* enforce 'change_rec_flag'? */
       int process_deleted;                /* retrieve recs marked for del? */
       int is_table_locked;                /* is the table read/write locked? */
       int is_systable;                    /* is this a system table? */
       int sort_max_open_bin;              /* max allowable open bins in sort */
       long sort_max_mem;                  /* max alloc mem for sort records */
       long record_number;                 /* current record number */
       long active_record_count;           /* current active record count */
       long deleted_record_count;          /* current deleted record count */
       long orig_position;                 /* original (start) pos of record */
       long current_position;              /* current file position */
       int record_status;                  /* 1=active,0=deleted */
       int autopack;                       /* autopack threshold (0=off) */
    #ifdef MULTIUSER
       struct dbeng_rep *rep_list;         /* link list of desired replication */
    #endif
       };

Here is an explanation of each of the dbeng_table structure members:

### next

This is a pointer to the next member in the link list. The Bbuuzzb database engine maintains a list of all accessed table using this single link list.

### handle

This is the actual file/stream handle used to access the table. In the client/server version and if the session table is active, most of the files will be closed. In the stand-alone version or if the session table is not active, most files will be open.

### rec

This is the record buffer. As fields are deleted/added or modified, the contents of this record buffer are changed. This buffer contains the current active record.

### name

This member is the actual OS name of the file including a drive designation, path and file name.

### tid

This is the table ID assigned when the table was first opened. Each tid is unique even if the engine has the same table opened many times.

### change_rec_flag

This member indicates whether the contents of the current record have changed. If the record contents have changed and the enforce_change_rec_flag is also on, all function calls that would empty the record buffer or change the file pointer will not be allowed.

### enforce_change_rec_flag

This flag instructs the Bbuuzzb database engine whether to enforce the change_rec_flag.

### process_deleted

This structure member instructs the Bbuuzzb database engine whether to include records marked for deletion in record processing like reading records, counting records etc.

### is_table_locked

This member indicates whether the table involved is currently locked. Note that this flag is currently not completely enforced.

### is_systable

This member indicates whether the table involved is a system table.

### sort_max_open_bin

This member holds the maximum allowable number of bin tables that may be open at once during a sort.

### sort_max_mem

This member contains the maximum allowable memory allocation for record contents in memory during a sort.

### record_number

This member represents the sequential record number within the current table. A zero record number usually indicates that there is no current record.

### active_record_count

This member contains the number of active records currently in the table.

### deleted_record_count

This member contains the number of records currently in the table that are marked for deletion.

### orig_position

This member contains the file pointer position to the beginning of the current record. A minus one (-1) value indicates the file pointer is at the top of the table and there is no current record.

### current_position

This member contains the current file pointer position.

### record_status

This member contains the status of the current record (one for active and zero for deleted).

### rep_list

This member is a pointer to the replication detail list. This link list is of type dbeng_rep. Here is the structure definition:

    struct dbeng_rep
       {
       struct dbeng_rep *next;
       int port;
       char *tname;
       };

Note that the rep_list is only present in multiuser situations (Bbuuzzb database server).

# Dbengcfg.h

This header contains the database engine configuration defaults based on the platform along with the name of the database configuration file and function prototypes for the database module dbengcfg.c.

# Dbengver.h

This header contains a single define which is the database engine version.

# Dbiocode.h

This header contains function prototypes for the database module dbiocode.c.

# Dblocal.h

This header contains function prototypes for the database module dblocal.c.

# Dblocfg.h

This header contains function prototypes for the database module dblocfg.c.

# Dbmess.h

This header is not tied to any specific database module. It contains defines of:

- engine error codes (Dbeng codes)
- database configuration codes
- database server send codes
- maximum size of a record/field (duplicate of same defines in dbeng.h)
- maximum size of any file/path
- default server host ID
- default server port number
- name of IPC configuration file

The definition of the server send structure dbeng_send_message is also in this header along with the engine list delimiter (DBENG_LIST_DELIM).

# Dbengses.h

This header contains the defines and function prototypes for the database server module dbengses.c.

# Dbengcat.h

This header contains the defines and function prototypes for the database server module dbengcat.c. This header also contains the catalog field definitions and the structure returned by the function dbeng_catalog_table_details. The current defintion of this structure called dbengcat_details is:

    struct dbengcat_details
       {
       char *logical_name;     // logical table name
       char *physical_name;    // OS path/file name
       int systable_flag;      // is it a system table?
       int apack;              // autopack threshold
    #ifdef MULTIUSER
       char *rep_list;         // replication list
    #endif
       };

# Dbengrep.h

This header contains the defines and function prototypes for the database server module dbengrep.c and also contains the definition of the dbengrep_servers structure. Here is the current definition:

    struct dbengrep_servers
       {
       char *host;
       int port;
       struct dbengrep_servers *next;
       };

# Dbfxp.h

This header contains the function prototypes for the fixed-point database module dbfxp.c.

# Dbengsrt.h

This header contains database sort definitions such as:

## dbeng_sort_node

This structure is used to hold record contents in memory just prior to sorting. A collection of these structures is used in a link list of all records in memory. Here is the current definition:

    struct dbeng_sort_node
       {
       char *arec;
       struct dbeng_sort_node *next;
       };

## dbeng_sort_spec

This structure is used to hold all details regarding the sort specifications. A collection of these structures is used in a link list of all sort specifications. Here is the current definition:

    struct dbeng_sort_spec
       {
       int order;
       int field_num;
       struct dbeng_sort_spec *next;
       };

## dbeng_sort_bin

This structure is used to hold bin tables in use. A collection of these structures is used in a link list of all bin tables in use. Here is the current definition:

    struct dbeng_sort_bin
       {
       struct dbeng_table *abin;
       struct dbeng_sort_bin *next;
       };

Notice that the bin table is reference by a dbeng_table pointer. A bin table is a temporary system table.

This header also contains the defines:

- DBENGSRT_ORDER_ASCENDING used in the dbeng_sort_spec structure
- DBENGSRT_ORDER_DESCENDING used in the dbeng_sort_spec structure
- DBENGSRT_MAX_SORT_ALLOC default used in the dbeng_table structure member sort_max_mem
- DBENGSRT_MAX_OPEN_BIN default used in the dbeng_table structure member sort_max_open_bin

# Iexlib.h

This header contains the definitions for the import API/library including:

- name of the Bbuuzzb table which holds the import templates
- field layout defines
- module prototypes
- import structure

## iex_spec

This structure is used to hold the import specifications from the template table. The current definition is:

    struct iex_spec
       {
       int source;
       int source_add1;
       int source_add2;
       int conversion;
       int conversion_parm;
       int dest;
       int dest_add1;
       int dest_add2;
       struct iex_spec *next;
       };

Goto Top | GPL Software Overview | GPL Library
Future Lab Home | Contact Webmaster | Feedback

Copyright © 1999-2006 Future Lab, Last Updated Jun 30, 2006