IBM Books

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


将数据插入表中

用户为 Anita Jones 将一条记录插入 Employee 表中。该记录包括 Anita 的 ID (128557)、姓名、照片和录音。源图象和音频内容在服务器上的文件中。图象以 BLOB 形式存储在表中;音频的内容仍在服务器文件中(表项引用服务器文件)。

用户的工作:用户使用包括语句的应用程序来在 employee 表中插入记录,这些语句显示在下例中。



EXEC SQL BEGIN DECLARE SECTION;
long hvInt_Stor;
long hvExt_Stor;
   EXEC SQL END DECLARE SECTION;
 
hvInt_Stor = MMDB_STORAGE_TYPE_INTERNAL;
hvExt_Stor = MMDB_STORAGE_TYPE_EXTERNAL;
 
EXEC SQL INSERT INTO EMPLOYEE VALUES(
        '128557',                         /*id*/
        'Anita Jones',                    /*name*/
        DB2IMAGE(                          /*Image Extender UDF*/
           CURRENT SERVER,                 /*database server name in*/
                                           /CURRENT SERVER register*/
           '/Employee/images/ajones.bmp'   /*image source file*/
           'ASIS',                         /*keep the image format*/
           :hvInt_Stor,                    /*store image in DB as BLOB*/
           'Anita''s picture'),            /*comment*/
        DB2AUDIO(                          /*Audio Extender UDF*/
           CURRENT SERVER,                 /*database server name in*/
                                           /*CURRENT SERVER register*/
           '/Employee/Sounds/ajones.wav',  /*audio source file*/
           'WAVE',                         /* audio format */
           :hvExt_Stor,                    /*retain content in server file*/
           'Anita''s voice')               /*comment*/
       );

发生的情况 作为对 INSERT 语句中的 DB2Image UDF 的响应, Image Extender:

作为对 INSERT 语句中的 DB2Audio UDF 的响应,Audio Extender:

触发器将图象和音频属性数据插入到各种管理支持表中。


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