イメージ、オーディオ、およびビデオ・エクステンダー 管理およびプログラミングの手引き

列を使用可能にする

DBxEnableColumn API (ここで、x は音声の場合は a、画像の場合は i、ビデオの場合は v) または、ENABLE COLUMN コマンドで DB2 エクステンダー用の列を使用可能にします。 API またはコマンドを発行するときは、適切な表および列を指定します。

列を使用可能にすると、エクステンダーは、そのユーザー表に属する管理サポート表に情報を追加します。 ユーザーは、その列が含まれているユーザー表に対し Control か Alter 権限が必要です。 列を使用可能にする場合には、データベースと表が使用可能になっていなければなりません。

次の例では、EMPLOYEE 表の PICTURE 列が使用可能にされ、画像データが入れられます。 データベースと表は両方とも使用可能になっています。

API の使用: この例には、エラー検査コードが組み込まれています。 このサンプル・プログラム全体は、SAMPLES サブディレクトリーの ENABLE.C ファイルにあります。

図 12. 列を使用可能にするサンプル・コード

char imageColumn[18+1] = "covers";
 
/*---- enable column for image extender ----*/
     printf("%s: Enabling columns......\n", program);
     step="DBiEnableColumn";
     rc = DBiEnableColumn(tableName, imageColumn);
     if (rc < 0) {
            printf("%s: %s failed!\n", program, step);
            printMsg(rc);
           DBiGetError(&sqlcode, errorMsgText);
           if (sqlcode)
              printf("sqlcode=%i, ", sqlcode);
           printf("errorMsgText=%s\n", errorMsgText)
          
    } else if (rc > 0) {
           printf("%s: %s, warning detected.\n", program, step);
           printMsg(rc);
           DBiGetError(&sqlcode, errorMsgText);
           printf("warningMsgText=%s\n", errorMsgText);
    } else
           printf("%s: %s OK\n", program, step);
/*---- enable column for image extender ----*/

db2ext コマンド行の使用: この例では、その列がすでに存在し、データベースおよび表が使用可能になっています。

enable column employee picture for db2image


[ ページのトップ | 前ページ | 次ページ | 目次 | 索引 ]