You need to open a QBIC catalog to perform subsequent actions that change the catalog. For example, you need to open a QBIC catalog before you add a feature to the catalog.
To open a QBIC catalog, use the QbOpenCatalog API call or OPEN QBIC CATALOG command.
When you open a QBIC catalog, you:
What if a catalog is already open? You cannot open a catalog for update operations if the catalog is open for update in another session. When you open a QBIC catalog, the Image Extender closes any QBIC catalog that you already opened in the current session.
Using the API: When you use the QbOpenCatalog API, you explicitly specify the mode in which you want the catalog opened. Specify:
QbiRead and QbiUpdate are constants that are defined in the include (header) file for QBIC, dmbqbapi.h.
You also need to point to the catalog handle. The catalog handle has a QBIC-specific data type of QbCatalogHandle. This data type is also defined in dmbqbapi.h. The Image Extender returns the catalog handle value as output from the API.
For example, the following API call opens a QBIC catalog for operations that read from the catalog:
SQLINTEGER mode; QbCatalogHandle *CatHdl; mode=qbiRead; /* open catalog for */ /* read operations */ rc=QbOpenCatalog( "employee", /* user table */ "picture", /* image column */ mode, /* open catalog mode */ &CatHdl); /* catalog handle */
Using the command line: When you issue the OPEN QBIC CATALOG command, the Image Extender attempts to open the catalog for update operations. If the catalog is currently open for update in another session, the Image Extender opens the catalog for read operations.
For example, the following command opens a QBIC catalog; the Image Extender attempts to open it for update operations:
OPEN QBIC CATALOG employee picture
Close the catalog when you finish QBIC-related activities: When you open a QBIC catalog, the Image Extender allocates resources to it such as memory. Close the catalog when you finish QBIC-related activities. This frees up the allocated resources.