IBM Books

Image, Audio, and Video Extenders Administration and Programming


Inserting data into a table

A user inserts a record for Anita Jones into the employee table. The record includes Anita's identification (128557), name, picture, and voice recording. The source image and audio content are in files on the server. The image is stored in the table as a BLOB; the content of the audio remains in the server file (the table entry refers to the server file).

What the user does: The user inserts the record into the employee table by using an application program that includes the statements that are shown in the following example.



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*/
       );

What happens In response to the DB2Image UDF in the INSERT statement, the Image Extender:

In response to the DB2Audio UDF in the INSERT statement, the Audio Extender:

Triggers insert the image and audio attribute data into various administrative support tables.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]