Image | Audio | Video |
---|---|---|
X | X | X |
Retrieves or updates the content of an image, audio, or video from a database. The content can be retrieved to a client buffer, client file, or server file.
Include file
Syntax
Retrieve content to buffer or client file
>>-Content--(--handle--)---------------------------------------><
Syntax
Retrieve a segment of content to buffer or client file
>>-Content--(--handle--,--offset--,--size--)-------------------><
Syntax
Retrieve content to server file
>>-Content--(--handle--,--target_file--,--overwrite--)---------><
Syntax
Retrieve content to buffer or client file with format conversion--image only
>>-Content--(--handle--,--target_format--)---------------------><
Syntax
Retrieve content to server file with format conversion--image only
>>-Content--(--handle--,--target_file--,--overwrite--,----------> >----target_format--)------------------------------------------><
Syntax
Retrieve content to buffer or client file with format conversion and additional changes--image only
>>-Content--(--handle--,--target_format--,--conversion_options--)--> >--------------------------------------------------------------><
Syntax
Retrieve content to server file with format conversion and additional changes--image only
>>-Content--(--handle--,--target_file--,--overwrite--,----------> >----target_format--,--conversion_options--)-------------------><
Syntax
Update content from buffer or client file
>>-Content--(--handle--,--content--,--source_format--,----------> >----target_file--)--------------------------------------------><
Syntax
Update content from server file
>>-Content--(--handle--,--source_file--,--source_format--,------> >----stortype--)-----------------------------------------------><
Syntax
Update content with user-supplied attributes from buffer or client file
>>-Content--(--handle--,--content--,----------------------------> >----target_file--,--attrs--,--thumbnail--)--------------------><
Syntax
Update content with user-supplied attributes from server file
>>-Content--(--handle--,--source_file--,--stortype--,--attrs--,--> >---thumbnail--)-----------------------------------------------><
Syntax
Update content from buffer or client file with format conversion--image only
>>-Content--(--handle--,--content--,--source_format--,----------> >----target_format--,--target_file--)--------------------------><
Syntax
Update content from server file with format conversion--image only
>>-Content--(--handle--,--source_file--,--source_format--,------> >----target_format--,--target_file--)--------------------------><
Syntax
Update content from buffer or client file with format conversion and additional changes--image only
>>-Content--(--handle--,--content--,--source_format--,----------> >----target_format--,--conversion_options--,--target_file--)---><
Syntax
Update content from server file with format conversion and additional changes--image only
>>-Content--(--handle--,--source_file--,--source_format--,------> >----target_format--,--conversion_options--,--target_file--)---><
Parameters (data type)
Return values (data type)
The content of the retrieved image, audio, or video if retrieved to a buffer, (BLOB(2G) AS LOCATOR). If retrieved to a file, VARCHAR(254).
For update, the handle of the image, audio, or video to be updated (DB2IMAGE, DB2AUDIO, or DB2VIDEO).
Examples
Retrieve into a server file the image that is stored for Anita Jones in the picture column of the employee table:
struct{ short len; char data[250]; }hvImg_fname; EXEC SQL END DECLARE SECTION; EXEC SQL SELECT CONTENT (PICTURE, '/employee/images/ajones.bmp',1) INTO :hvImg_fname FROM EMPLOYEE WHERE NAME='Anita Jones';
Retrieve into a client buffer the 1-MB audio clip stored for Robert Smith in the sound column of the employee table:
EXEC SQL BEGIN DECLARE SECTION; SQL TYPE IS BLOB_LOCATOR audio_loc; EXEC SQL END DECLARE SECTION; EXEC SQL SELECT CONTENT (SOUND, 1, 1000000) INTO :audio_loc FROM EMPLOYEE WHERE NAME='Robert Smith';
Update Anita Jones's image in the picture column of the employee table; convert the format of the image from BMP to GIF and reduce the image to 50% of its original size:
EXEC SQL UPDATE EMPLOYEE SET picture = CONTENT(PICTURE, '/employee/newimg/ajones.bmp', 'BMP', 'GIF', '-s 0.5', ''); WHERE NAME='Anita Jones';