Content UDF は多重定義されます。 つまり、UDF の使用方法に応じて異なる形式を持ちます。 形式は次のとおりです。
形式 1: クライアント・バッファーまたはクライアント・ファイルからオブジェクトを更新する。
Content( handle, /* object handle */ content, /* object content */ source_format, /* source format */ target_file /* target file name for storage in file */ /* server or NULL for storage in table as BLOB */ );
形式 2: サーバー・ファイルからオブジェクトを更新する。
Content( handle, /* object handle */ source_file, /* server file name */ source_format, /* source format */ stortype /* MMDB_STORAGE_TYPE_EXTERNAL=store */ /* in file server */ /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/ );
形式 3: ユーザー提供の属性をもつオブジェクトをクライアント・バッファーまたはクライアント・ファイルから更新する。
Content( handle, /* object handle */ content, /* object content */ target_file, /* target file name for storage in file server */ /* or NULL for storage in table as BLOB */ attrs, /* user-supplied attributes */ thumbnail /* thumbnail (image and video only) */ );
形式 4: ユーザー提供の属性をもつオブジェクトをサーバー・ファイルから更新する。
Content( handle, /* object handle */ source_file, /* source file name */ stortype, /* MMDB_STORAGE_TYPE_EXTERNAL=store */ /* in file server*/ /* MMDB_STORAGE_TYPE_INTERNAL=store */ /* as a BLOB*/ attrs, /* user-supplied attributes */ thumbnail /* thumbnail (image and video only) */ );
画像オブジェクトでは、Content UDF はさらに 2 つの形式をとります。
形式 5: クライアント・バッファーまたはクライアント・ファイルからの画像は、以下のように形式変換して更新する。
Content( handle, /* object handle */ content, /* object content */ source format, /* source format */ target format, /* target format */ target_file /* target file name for storage in file server */ /* or NULL for storage in table as BLOB */ );
形式 6: サーバー・ファイルからのオブジェクトを形式変換して更新する。
Content( handle, /* object handle */ source_file, /* server file name */ source format, /* source format */ target format, /* target format */ target_file /* target file name for storage in file server */ /* or NULL for storage in table as BLOB */ );
形式 7: クライアント・バッファーまたはクライアント・ファイルからの画像は、以下のように形式変換および追加の変更をして更新する。
Content( handle, /* object handle */ content, /* object content */ source format, /* source format */ target format, /* target format */ conversion_options, /* conversion options */ target_file /* target file name for storage in file server */ /* or NULL for storage in table as BLOB */ );
形式 8: サーバー・ファイルからのオブジェクトは、以下のように形式変換および追加の変更をして更新する。
Content( handle, /* object handle */ source_file, /* server file name */ source format, /* source format */ target format, /* target format */ conversion_options, /* conversion options */ target_file /* target file name for storage in file server */ /* or NULL for storage in table as BLOB */ );
たとえば、C アプリケーション・プログラムの次のステートメントでは、従業員表の画像が更新されます。 この更新のソースの内容は ajones.bmp という名前のサーバー・ファイルにあります。 更新された画像は従業員表に BLOB として保管されます。 (これは上の形式 2 に対応します。)
EXEC SQL UPDATE EMPLOYEE SET PICTURE=CONTENT( PICTURE, /*image handle*/ '/employee/newimg/ajones.bmp', /*source file */ 'ASIS', /*keep the image format*/ ''); /*store image in DB as BLOB*/ WHERE NAME='Anita Jones';
C アプリケーションの次のステートメントでは、前の例と同じ画像が更新されます。 しかしこの場合には、更新の際に、形式が BMP から GIF へ変換されます。 (これは上の形式 6 に対応します。)
EXEC SQL UPDATE EMPLOYEE SET PICTURE=CONTENT( PICTURE, /*image handle*/ '/employee/newimg/ajones.bmp', /*source file */ 'BMP', /*source format*/ 'GIF', /*target format*/ ''); /*store image in DB as BLOB*/ WHERE NAME='Anita Jones';