Image | Audio | Video |
---|---|---|
X |
Stores the content of a video in a database table. The video source can be in a client buffer, client file, or server file. The video can be stored in the database table as a BLOB, or in a server file (referred to by the database table). The video source can be in a supported format, in which case the DB2 Video Extender identifies its attributes for storage, or in an unsupported format, in which case the attributes must be specified in the UDF.
Include file
dmbvideo.h
Syntax
Store content from buffer or client file
>>-DB2Video--(--dbname--,--content--,--format--,----------------> >----target_file--,--comment--)--------------------------------><
Syntax
Store content from server file
>>-DB2Video--(--dbname--,--source_file--,--format--,--stortype--,--> >---comment--)-------------------------------------------------><
Syntax
Store content with user-supplied attributes from buffer or client file
>>-DB2Video--(--dbname--,--content--,--target_file--,-----------> >----comment--,--attrs--,--thumbnail--)------------------------><
Syntax
Store content with user-supplied attributes from server file
>>-DB2Video--(--dbname--,--source_file--,--stortype--,--comment--,--> >---attrs--,--thumbnail--)-------------------------------------><
Parameters (data type)
Return values (data type)
Handle of the video (DB2VIDEO)
Examples
Insert a record that includes a video clip for Anita Jones into the employee table. The video source is in a client buffer. Store the video clip in the table as a BLOB:
EXEC SQL BEGIN DECLARE SECTION SQL TYPE IS BLOB (8M) vid; EXEC SQL END DECLARE SECTION; EXEC SQL INSERT INTO EMPLOYEE VALUES( '128557', 'Anita Jones', DB2VIDEO( CURRENT SERVER, :vid, 'MPEG1', CAST(NULL as LONG VARCHAR), 'Anita''s video'));
Insert a record that includes a video clip for Robert Smith into the employee table. The video source is in a server file. The employee table record will point to the file:
EXEC SQL BEGIN DECLARE SECTION; long hvStorageType; EXEC SQL END DECLARE SECTION; hvStorageType = MMDB_STORAGE_TYPE_EXTERNAL; EXEC SQL INSERT INTO EMPLOYEE VALUES( '384779', 'Robert Smith', DB2VIDEO( CURRENT SERVER, '/employee/videos/rsmith.mpg', 'MPEG1', :hvStorageType, 'Robert''s video'));
Insert a record that includes a video clip in a database table. The source video clip, which is in a server file, has a user-defined format. Keep the video content in the server file (the database table record will point to the file). Also store a thumbnail that represents the video:
EXEC SQL BEGIN DECLARE SECTION; long hvStorageType; struct { short len; char data[400]; }hvVidattrs; struct { short len; char data[10000]; }hvThumbnail; EXEC SQL END DECLARE SECTION; MMDBVideoAttrs *pvideoAttr; hvStorageType = MMDB_STORAGE_TYPE_EXTERNAL; pvideoAttr=(MMDBVideoAttrs *)hvVidattrs.data; strcpy(pvideoAttr>cFormat,"Formatv"); pvideoAttr.len=sizeof(MMDBVideoAttrs);
·
·
·
/* Generate thumbnail and assign data */ /* in video structure */
·
·
·
EXEC SQL INSERT INTO EMPLOYEE VALUES( '128557', 'Anita Jones', DB2VIDEO( CURRENT SERVER, '/employee/videos/ajones.vid', :hvStorageType, 'Anita''s video', :hvVidattrs, :hvThumbnail) );