IBM Books

Image, Audio, and Video Extenders Administration and Programming


Checking the status of data objects

You can check whether databases, tables, and columns are enabled to hold extender data. The following example determines if the current database is enabled for the Image Extender. The database is already connected. The complete sample program is in the API.C file in the SAMPLES subdirectory.

Using the API: The sample code in the following example includes some error-checking code.

Figure 13. Sample code that checks if a database is enabled

/*---- Query the database using DBiIsDatabaseEnabled API. ----------*/
step="DBiIsDatabaseEnabled API";
rc = DBiIsDatabaseEnabled(&status);
if (rc < 0) {
     printf("%s: %s FAILED!\n", argv[0], step);
     printMsg(rc);
     DBiGetError(&sqlcode, errorMsgText);
     printf("sqlcode=%i, errorMsgText=%s\n", sqlcode, errorMsgText);
     fail = TRUE;
} else if (rc > 0) {
     printf("%s: %s, warning detected.\n", argv[0], step);
     printMsg(rc);
     DBiGetError(&sqlcode, errorMsgText);
     printf("sqlcode=%i, errorMsgText=%s\n", sqlcode, errorMsgText);
} else {
     if (status == 1) {
         printf("%s: \"%s\" database is enabled for Image Extender\n",
                argv[0], dbName);
         printf("%s: %s PASSED\n\n", argv[0], step);
     } else if (status == 0) {
         printf("%s: \"%s\" database is not enabled for Image Extender\n",
                argv[0], dbName);
         printf("%s: %s PASSED\n\n", argv[0], step);
     } else
         printf("%s: %s FAILED, invalid status!\n", argv[0], step);
}

Using the db2ext command line:

get extender status

Checking the status of user tables and columns is similar to checking the status of a database. Use the DBxIsTableEnabled and DBxIsColumnEnabled APIs, or the GET EXTENDER STATUS command.


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