Tcl Database Catalog Management

The Tcl database catalog management module has the file name dbengcat.tcl. This module provides catalog management features for the Bbuuzzb databse engine and server.

The catalog is a regular Bbuuzzb table containing table details including the physical OS file name, a logical table name, autopack threshold, and replication details.

This Tcl version stores catalog details for a single table in the global dbengcat_details array.

Here is a list of procedures in this module:

- dbeng_catalog_new
- dbeng_catalog_new_table
- dbeng_catalog_delete
- dbeng_catalog_table_details
- dbeng_catalog_fname
- dbeng_catalog_list
- dbeng_catalog_tfind
- dbeng_catalog_open
- dbeng_catalog_close

# Module Dependencies

This module is part of any single user database application and the Bbuuzzb database server and requires the following modules:

- fio.tcl
- parse.tcl
- logger.tcl
- dbeng.tcl
- dbiocode.tcl
- dbengcfg.tcl
- dbengsrt.tcl

# Module Definition Files

The following modules are required along with this module:

- stdhead.tcl
- dbmess.tcl

# Module Procedures

## dbeng_catalog_new

    Declaration  : proc dbeng_catalog_new {tname fname}
    Parameters   :
          Name   : tname
          Type   : string
    Description  : logical table name

          Name   : fname
          Type   : string
    Description  : physical OS file name

    Returns      : dbeng code

This procedure will create a new entry in the catalog. The logical table name must not already exist in the catalog.

## dbeng_catalog_new_table

    Declaration  : proc dbeng_catalog_new_table {iname oname systable_flag}
    Parameters   :
          Name   : iname
          Type   : string
    Description  : input name(s)

          Name   : oname
          Type   : string
    Description  : output name

          Name   : systable_flag
          Type   : boolean flag
    Description  : system table flag

    Returns      : dbeng code

This procedure will translate the table name(s) to the proper output name required by the db_new_table procedure. The input name(s) may contain a single name or two names comma delimited. A single name is assumed to be the table physical file name. Two names are assumed to be the table logical name followed by the physical name. The translated name is placed into the output name upon success.

## dbeng_catalog_delete

    Declaration  : proc dbeng_catalog_delete {tname}
    Parameters   :
          Name   : tname
          Type   : string
    Description  : logical table name

    Returns      : dbeng code

This procedure will delete a catalog entry by its logical table name.

## dbeng_catalog_table_details

    Declaration  : proc dbeng_catalog_table_details {tname systbale_flag}
    Parameters   :
          Name   : tname
          Type   : string
    Description  : logical table name

          Name   : systable_flag
          Type   : boolean flag
    Description  : system table flag

    Returns      : dbeng code

This procedure will find a catalog entry by its logical table name and load all catalog details into the array dbengcat_details.

## dbeng_catalog_fname

    Declaration  : proc dbeng_catalog_fname {tname fname}
    Parameters   :
          Name   : tname
          Type   : string
    Description  : input logical table name

          Name   : fname
          Type   : string
    Description  : output physical file name

    Returns      : dbeng code

This procedure will locate and return the output physical file name based on the input logical table name. This function assumes that the catalog is currently closed.

## dbeng_catalog_list

    Declaration  : proc dbeng_catalog_list {pat lout}
    Parameters   :
          Name   : pat
          Type   : string
    Description  : input match pattern

          Name   : lout
          Type   : string
    Description  : output catalog list

    Returns      : dbeng code

This procedure will return a list of matching table names (logical) from the system catalog. The list is returned in the output catalog list. The list is delimited by DBENG_LIST_DELIM. Each entry in the list contains the logical name followed by the file/path name (physical name). The two fields in the list are delimited by a comma. The input match pattern may contain a pattern acceptable to the Tcl string match command. If the input match pattern is empty, all entries from the catalog will be returned.

## dbeng_catalog_tfind

    Declaration  : proc dbeng_catalog_tfind {tname}
    Parameters   :
          Name   : tname
          Type   : string
    Description  : input logical table name

    Returns      : dbeng code

This procedure will attempt to locate the input logical table name within the catalog. The catalog is assumed to already be open.

## dbeng_catalog_open

    Declaration  : proc dbeng_catalog_open {}

    Returns      : dbeng code

This procedue will open the catalog.

## dbeng_catalog_close

    Declaration  : proc dbeng_catalog_close {}

    Returns      : dbeng code

This procedure will close the catalog.

Goto Top | Tcl Database Engine and API's | Tcl Applications | Tcl Software Overview | Tcl Library Overview
| Future Lab Home | Contact Webmaster | Feedback

Copyright © 2006 Future Lab, Last Updated Jul 01, 2006