IBM Books

Image, Audio, and Video Extenders Administration and Programming

Specifying database or file storage for updates

You can update an image, audio, or video object that is stored in a database table as a BLOB, or in a server file (and pointed to from the database).

If you update an object from a client buffer or client file, you indicate BLOB or server file storage as a result of what you specify in the filename parameter. If you specify a file name, it indicates that you want to update an object whose content is in a server file. If you specify a null file name, it indicates that you want to update an object that is stored as a BLOB in a database table.

For example, the following statements in a C application program update an image whose content is in a server file. The update source is in a client buffer. The image comment is updated, too.

EXEC SQL BEGIN DECLARE SECTION;
  SQL TYPE IS BLOB (2M) Img_buf
EXEC SQL END DECLARE SECTION;
 
EXEC SQL UPDATE EMPLOYEE
   SET PICTURE=REPLACE(
                   PICTURE,
                   :Img_buf,
                   'ASIS',
                   '/employee/newimg/ajones.bmp',      /*update image in*/
                                                       /*server file*/
                   'Anita''s new picture')
   WHERE NAME='Anita Jones';

If you update an object from a server file, specify MMDB_STORAGE_TYPE_INTERNAL to update an object that is stored in a database table as a BLOB. If you want to update an object whose content is in the server file, specify MMDB_STORAGE_TYPE_EXTERNAL.

For example, in the following C application program, an audio clip is updated. The content of the audio clip is in a server file. The source for the update is also in a server file.

EXEC SQL BEGIN DECLARE SECTION;
  long hvStorageType;
EXEC SQL END DECLARE SECTION;
 
hvStorageType=MMDB_STORAGE_TYPE_EXTERNAL;
 
EXEC SQL UPDATE EMPLOYEE
   SET SOUND=CONTENT(
                 SOUND,
                 '/employee/newimg/ajones.wav',
                 'WAVE',
                 :hvStorageType)        /*update audio in server file*/
   WHERE NAME='Anita Jones';


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