IBM Books

Image Extender、Audio Extender 和 Video Extender 管理和程序设计

用于更新的 Replace UDF 格式

Replace UDF 是重载的,这表示视使用此 UDF 的方法的不同,它有不同的格式。格式如下:

格式 1:从客户机缓冲区或客户机文件更新对象,并更新其注解:

Replace(
     handle,                      /* object handle */
     content,                     /* object content */
     source_format,               /* source format */
     target_file,                 /* target file name for storage in file */
     comment                      /* user comment */
  );

格式 2:从服务器文件更新对象,并更新其注解:

Replace(
     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*/
     comment                      /* user comment */
  );

格式 3:从客户机缓冲区或客户机文件替换具有用户提供的属性的对象,并更新其注解:

Replace(
     handle,                      /* object handle */
     content,                     /* object content */
     target_file,                 /* target file name for storage in file */
                                  /* or NULL for storage in table as BLOB */
     comment,                     /* user comment */
     attrs,                       /* user-supplied attributes */
     thumbnail                    /* thumbnail */
  );

格式 4:存储服务器文件中具有用户提供的属性的对象:

Replace(
     handle,                      /* object handle */
     source_file,                 /* server file name */
     stortype,                    /* MMDB_STORAGE_TYPE_EXTERNAL=store */
                                  /* in file server*/
                                  /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/
     comment,                     /* user comment */
     attrs,                       /* user-supplied attributes */
     thumbnail                    /* thumbnail */
  );

Replace UDF 有下列附加格式(仅针对图象对象):

格式 5: 从客户机缓冲区或客户机文件更新图象, 并进行格式转换和更新其注解:

Replace(
     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 */
     comment                      /* user comment */
  );

格式 6: 从服务器文件更新对象,进行格式转换,并更新其注解:

Replace(
     handle,                      /* object handle */
     source_file,                 /* server file name */
     source_format,               /* source format */
     target_format,               /* target format */
     target_file,                 /* MMDB_STORAGE_TYPE_EXTERNAL=store */
                                  /* in file server */
                                  /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/
     comment                      /* user comment */
  );

格式 7: 从客户机缓冲区或客户机文件更新图象, 并进行格式转换和其他更改,以及更新其注解:

Replace(
     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 */
     comment                      /* user comment */
  );

格式 8: 从服务器文件更新对象,进行格式转换和其他更改,并更新其注解:

Replace(
     handle,                      /* object handle */
     source_file,                 /* server file name */
     source_format,               /* source format */
     target_format,               /* target format */
     conversion_options,          /* conversion options */
     target_file,                 /* MMDB_STORAGE_TYPE_EXTERNAL=store */
                                  /* in file server */
                                  /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/
     comment                      /* user comment */
  );

例如,C 应用程序中的下列语句更新 Employee 表中的音频剪辑, 并更新与之相关联的注解。用于更新的源内容在名为 ajones.wav 的服务器文件中。更新后的音频剪辑以 BLOB 形式存储在 Employee 表中,不进行格式转换 (Audio Extender 不支持格式转换)。(这与上面的格式 2 相对应。)

EXEC SQL BEGIN DECLARE SECTION;
     long hvStorageType;
   EXEC SQL END DECLARE SECTION;
 
hvStorageType=MMDB_STORAGE_TYPE_INTERNAL;
 
EXEC SQL UPDATE EMPLOYEE
   SET SOUND=REPLACE(
                 SOUND,                         /*audio handle*/
                 '/Employee/newaud/ajones.wav', /*source file */
                 'WAV',                         /*keep the audio format*/
                 :hvStorageType,                /*store audio in DB as BLOB*/
                 'Anita''s new greeting')       /*user comment*/
       WHERE NAME='Anita Jones';

在下例中,将更新图象及其相关联的注解。用于更新的源内容位于服务器文件中。更新后的图象以 BLOB 形式存储在 Employee 表中,并在更新时由 BMP 格式转化为 GIF 格式。(这与上面的格式 6 相对应。)

EXEC SQL UPDATE EMPLOYEE
   SET PICTURE=REPLACE(
                 PICTURE,                         /*image handle*/
                 '/employee/newimg/ajones.bmp',   /*source file */
                 'BMP',                           /*source format*/
                 'GIF',                           /*target format*/
                 ''                               /*store image in DB as BLOB*/
                 'Anita''s new picture')
   WHERE NAME='Anita Jones';                      /* user comment */


[ 页的顶部 | 上一页 | 下一页 | 目录 | 索引 ]