Database Catalog Management

The database catalog management module has the file name dbengcat.c. This module provides catalog management features for the Bbuuzzb databse engine and server. Any mention of QNX in this document refers to the QNX 4.x OS. This API can be compiled for all stated platforms.

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

Here is a list of functions in this module:

Module Dependencies

This module is part of any single user database application and the Bbuuzzb database server and must be linked with the following modules:

Under the Linux/Unix/QNX platforms, this module is compiled along with the other database modules as part of the script cdbeng.

Module Header Files

This module depends on the following header files:

Module Functions

dbeng_catalog_new

Prototype  : int dbeng_catalog_new(char *tname, char *fname)
Parameters :
      Name : tname
Description: logical table name

      Name : fname
Description: physical OS file name

Returns    : dbeng code

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

dbeng_catalog_new_table

Prototype  : int dbeng_catalog_new_table(char *iname, char *oname,
                                         int systable_flag)
Parameters :
      Name : iname
Description: input name(s)

      Name : oname
Description: output name

      Name : systable_flag
Description: system table flag

Returns    : dbeng code

This function will translate the table name(s) to the proper output name required by the new.table command. 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

Prototype  : int dbeng_catalog_delete(char *tname)
Parameters :
      Name : tname
Description: logical table name

Returns    : dbeng code

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

dbeng_catalog_init_table_details

Prototype  : int dbeng_catalog_init_table_details(char *tname,
                                                  int systbale_flag,
                                                  struct dbengcat_details **det)
Parameters :
      Name : tname
Description: logical table name

      Name : systable_flag
Description: system table flag

      Name : det
Description: catalog detail structure

Returns    : dbeng code

This function will prepare the catalog detail structure for use.

dbeng_catalog_term_table_details

Prototype  : int dbeng_catalog_term_table_details(struct dbengcat_details **det)
Parameters :
      Name : det
Description: catalog detail structure

Returns    : dbeng code

This function will deallocate the entire catalog detail structure.

dbeng_catalog_table_details

Prototype  : int dbeng_catalog_table_details(struct dbengcat_details *det)
Parameters :
      Name : det
Description: catalog detail structure

Returns    : dbeng code

This function will find a catalog entry by its logical table name and return all catalog details for that table. Before this function can be called the dbengcat_details structure must have been initialized by first calling the function dbeng_catalog_init_table_details.

dbeng_catalog_fname

Prototype  : int dbeng_catalog_fname(char *tname, char *fname)
Parameters :
      Name : tname
Description: input logical table name

      Name : fname
Description: output physical file name

Returns    : dbeng code

This function 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_rep_list

Prototype  : static int dbeng_catalog_rep_list(char *rep_list)
Parameters :
      Name : rep_list
Description: output replication list

Returns    : dbeng code

This function will get and return the replication list for a table. Upon success, the replication list will be loaded into the output replication list which must already be allocated to sufficient size. The format of the replication list is:

   port,tname

There may be multiple entries in the replication list. Each entry will be delimited by DBENG_LIST_DELIM. Note that this function assumes the catalog is currently open and the catalog file pointer is pointing at the record in question.

dbeng_catalog_tfind

Prototype  : static int dbeng_catalog_tfind(char *tname)
Parameters :
      Name : tname
Description: input logical table name

Returns    : dbeng code

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

dbeng_catalog_ffind

Prototype  : static int dbeng_catalog_ffind(char *fname)
Parameters :
      Name : fname
Description: input physical table name

Returns    : dbeng code

This private function will attempt to locate the input physical table name within the catalog. The catalog is assumed to already be open.

dbeng_catalog_open

Prototype  : static int dbeng_catalog_open(void)

Returns    : dbeng code

This private function will open the catalog.

dbeng_catalog_close

Prototype  : static int dbeng_catalog_close(void)

Returns    : dbeng code

This private function will close the catalog.

dbeng_catalog_list

Prototype  : int dbeng_catalog_list(char *pat, char *lout)
Parameters :
      Name : pat
Description: input match pattern

      Name : lout
Description: output catalog list

Returns    : dbeng code

This function will return a list of matching table names (logical) from the system catalog. The list is returned in the output catalog list which must be already allocated to sufficient size. 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 pmatch function. If the input match pattern is NULL or empty, all entries from the catalog will be returned.

Goto Top | Future Lab Home | Contact Webmaster | Feedback

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