IBM Books

Image, Audio, and Video Extenders Administration and Programming

Retrieving information about a QBIC catalog

You can retrieve the following information about a QBIC catalog:

Use the QbGetCatalogInfo API to retrieve the user table and column names, the number of features, and auto catalog setting. Use the QbListFeatures API to retrieve the feature names. Or use the GET QBIC CATALOG INFO command to retrieve all the information.

The QBIC catalog must be open before you can retrieve information.

Using the API: When you use the QbGetCatalogInfo API, you need to specify the handle of the QBIC catalog. You also need to point to a structure in which the Image Extender returns the catalog information. The catalog information structure is defined in the include (header) file for QBIC, dmbqapi.h, as follows:

typedef struct{
          char       tableName[qbiMaxTableName+1]    /* user table */
          char       columnName[qbiMaxColumnName+1]  /* image column */
          SQLINTEGER featureCount;                   /* number of features */
          SQLINTEGER autoCatalog;                    /* auto catalog flag */
} QbCatalogInfo;

When you issue the QbListFeatures API call, you need to allocate a buffer to hold the returned feature names. A blank character separates feature names stored in the buffer. You also need to specify the catalog handle, and the size of the buffer for the returned feature names. To estimate the needed buffer size, you can use the feature count that is returned by the QbGetCatalogInfo API, and multiply the count by the longest feature name. You can use the constant qbiMaxFeatureName as the size of the longest feature name.

The API calls in the following example retrieve information about a QBIC catalog. Notice how the feature count that is returned by the QbGetCatalogInfo API and the qbiMaxFeature name constant is used to calculate the buffer size for the QbListFeatures API:

long  bufSize;
long  count;
char  *featureNames;
 
QbCatalogHandle  CatHdl;
QbCatalogInfo    catInfo;
 
/* Get user table name, image column name, feature count, */
/* and auto catalog setting */
 
rc=QbGetCatalogInfo(
                CatHdl,                              /* catalog handle */
                &catInfo);                           /* catalog info. structure */
 
/* List feature names */
 
bufSize=catInfo.featureCount*qbiMaxFeatureName;
featureNames=malloc(bufSize);
 
rc=QbListFeatures(
                CatHdl,                       /* catalog handle */
                bufSize                       /* size of buffer */
                count,                        /* feature count */
                featureNames);                /* buffer for feature names */

Using the command line: The GET QBIC CATALOG INFO command acts on the currently open catalog. In the following example, the command is used to retrieve information about the currently open QBIC catalog:

GET QBIC CATALOG INFO


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]