IBM Books

Image, Audio, and Video Extenders Administration and Programming

Updating a comment

You can update a comment by itself, or you can update a comment when you update its associated object.

Use the Comment UDF to update a comment by itself. Specify the content of the updated comment as well as the table column that contains the object's handle. Use a host variable to transmit the content to the server. For example, the following statements declare a host variable named hvRemarks, and use it to update an existing comment for a stored video clip.

EXEC SQL BEGIN DECLARE SECTION;
  struct {
         short len;
         char data [40];
  }hvRemarks;
EXEC SQL END DECLARE SECTION;
 
/* Get the old comment */
 
EXEC SQL SELECT COMMENT(VIDEO)
     INTO :hvRemarks
     FROM EMPLOYEE
     WHERE NAME = 'Anita Jones';
 
/* Append to old comment */
 
hvRemarks.data[Remarks.len]='\0';
hvRemarks.len=strlen(hvRemarks.data);
strcat (hvRemarks.data, "Updated video");
EXEC SQL UPDATE EMPLOYEE
     SET VIDEO=COMMENT(VIDEO, :hvRemarks)
     WHERE NAME = 'Anita Jones';

Use the Replace UDF to update a comment when you update its associated object. For example, the following statements update a video clip that is stored in a server file, as well as its associated comment.

EXEC SQL BEGIN DECLARE SECTION;
  long hvStorageType;
EXEC SQL END DECLARE SECTION;
 
hvStorageType=MMDB_STORAGE_TYPE_EXTERNAL;
 
EXEC SQL UPDATE EMPLOYEE
   SET VIDEO=REPLACE(
                 VIDEO,
                 '/employee/newvid/ajones.mpg',
                 'MPEG1',
                 :hvStorageType,
                 'Anita''s new video')        /*updated comment*/
   WHERE NAME='Anita Jones';


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