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 具有下列附加的格式:
格式 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';