IBM Books

Image, Audio, and Video Extenders Administration and Programming

Replace


Image Audio Video
X X X

Updates the content of an image, audio, or video that is stored in a database, and updates its comment.

Include file

image
dmbimage.h

audio
dmbaudio.h

video
dmbvideo.h

Syntax

Update content from buffer or client file and update comment

>>-Replace--(--handle--,--content--,--source_format--,---------->
 
>----target_file--,--comment--)--------------------------------><
 

Syntax

Update content from server file and update comment

>>-Replace--(--handle--,--source_file--,--source_format--,--stortype--,-->
 
>---comment--)-------------------------------------------------><
 

Include file

Update content with user-supplied attributes from buffer or client file and update comment

>>-Replace--(--handle--,--content--,--target_file--,------------>
 
>----comment--,--attrs--,--thumbnail--)------------------------><
 

Include file

Update content with user-supplied attributes from server file and update comment

>>-Replace--(--handle--,--source_file--,--stortype--,--comment--,-->
 
>---attrs--,--thumbnail--)-------------------------------------><
 

Syntax

Update content from buffer or client file with format conversion and update comment--image only

>>-Replace--(--handle--,--content--,--source_format--,---------->
 
>----target_format--,--target_file--,--comment--)--------------><
 

Syntax

Update content from server file with format conversion and update comment--image only

>>-Replace--(--handle--,--source_file--,--source_format--,------>
 
>----target_format--,--target_file--,--comment--)--------------><
 

Syntax

Update content from buffer or client file with format conversion and additional changes and update comment--image only

>>-Replace--(--handle--,--content--,--source_format--,---------->
 
>----target_format--,--target_file--,--conversion_options--,---->
 
>----comment--)------------------------------------------------><
 

Syntax

Update content from server file with format conversion and additional changes and update comment--image only

>>-Replace--(--handle--,--source_file--,--source_format--,------>
 
>----target_format--,--conversion_options--,--target_file--,---->
 
>----comment--)------------------------------------------------><
 

Parameters (data type)

handle (DB2IMAGE, DB2AUDIO, or DB2VIDEO)
Column name or host variable that contains the handle of the image, audio, or video.

source_file (LONG VARCHAR)
The name of the file that contains the content for the update of the image, audio, or video.

target_file (LONG VARCHAR)
The name of the file that contains the content of the image, audio, or video to be updated.

create_target (INTEGER)
A value that indicates whether a target file is to be created if the source content is in a server file. The value can be 0 or 1. A value of 0 means the target file will not be created (in effect, the retrieval will not take place). A value of 1 means that the target file will be created (if the target file already exists, the effect of this value is to overwrite the file). If the source content is a BLOB, the target file is always created (if the file already exists, it is overwritten).

target_format (VARCHAR(8))
The format of the image after retrieval. The format of the source image will be converted as appropriate. If the content is updated with format conversion, the path to the target file needs to be specified in the DB2IMAGEPATH and DB2MMPATH environment variables. For MPG1 format, you can specify MPG1, mpg1, MPEG1, or mpeg1. For MPG2 format, you can specify MPG2, mpg2, MPEG2, or mpeg2.

content (BLOB(2G) AS LOCATOR)
The host variable that contains the content for update of the image, audio, or video. The host variable can be of type BLOB, BLOB_FILE, or BLOB_LOCATOR. DB2 promotes the data type to BLOB_LOCATOR and passes the LOB locator to the Replace UDF.

source_format (VARCHAR(8))
The format of the source for update of the image, audio, or video. A null value or empty string can be specified, or for image only, the character string ASIS; in these three cases, the extender attempts to determine the format automatically. For MPG1 format, you can specify MPG1, mpg1, MPEG1, or mpeg1. For MPG2 format, you can specify MPG2, mpg2, MPEG2, or mpeg2.

comment (LONG VARCHAR)
A comment.

attrs (LONG VARCHAR FOR BIT DATA)
The attributes of the image, audio, or video

thumbnail (LONG VARCHAR FOR BIT DATA)
A thumbnail of the image or video frame (image and video only)

conversion_options (VARCHAR(100))
Specifies changes, such as rotation and compression, to be applied to the image when it is updated. See Table 5 for the supported conversion options.

Return values (data type)

The handle of the image, audio, or video to be updated (DB2IMAGE, DB2AUDIO, or DB2VIDEO).

Examples

Update Anita Jones's image in the picture column of the employee table, convert the format of the image from BMP to GIF, and update the comment:

EXEC SQL BEGIN DECLARE SECTION;
  long hvStorageType;
EXEC SQL END DECLARE SECTION;
 
hvStorageType = MMDB_STORAGE_TYPE_INTERNAL;
 
EXEC SQL UPDATE EMPLOYEE
  SET PICTURE = REPLACE(PICTURE,
        '/employee/newimg/ajones.bmp',
        'BMP',
        'GIF',
        :hvStorageType,
        'Anita''s new picture')
  WHERE NAME='Anita Jones';


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