Image | Audio | Video |
---|---|---|
X |
Stores the content of an audio in a database table. The audio source can be in a client buffer, client file, or server file. The audio can be stored in the database table as a BLOB, or in a server file (referred to by the database table). The audio source can be in a supported format, in which case, the DB2Audio Extender identifies its attributes for storage, or in an unsupported format, in which case the attributes must be specified in the UDF.
Include file
dmbaudio.h
Syntax
Store content from buffer or client file
>>-DB2Audio--(--dbname--,--content--,--format--,----------------> >----target_file--,--comment--)--------------------------------><
Syntax
Store content from server file
>>-DB2Audio--(--dbname--,--source_file--,--format--,--stortype--,--> >---comment--)-------------------------------------------------><
Syntax
Store content with user-supplied attributes from buffer or client file
>>-DB2Audio--(--dbname--,--content--,--target_file--,-----------> >----comment--,--attrs--)--------------------------------------><
Syntax
Store content with user-supplied attributes from server file
>>-DB2Audio--(--dbname--,--source_file--,--stortype--,--comment--,--> >---attrs--)---------------------------------------------------><
Parameters (data type)
Return values (data type)
Handle of the audio (DB2AUDIO)
Examples
Insert a record that includes an audio clip for Anita Jones into the employee table. The audio source is in a client buffer. Store the audio clip in the table as a BLOB:
EXEC SQL BEGIN DECLARE SECTION; SQL TYPE IS BLOB (5M) aud_seg; EXEC SQL END DECLARE SECTION; EXEC SQL INSERT INTO EMPLOYEE VALUES( '128557', 'Anita Jones', DB2AUDIO( CURRENT SERVER, :aud_seg, 'WAVE', CAST(NULL as LONG VARCHAR), 'Anita''s voice'));
Insert a record that includes an audio clip for Robert Smith into the employee table. The audio 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', DB2AUDIO( CURRENT SERVER, '/employee/sounds/rsmith.wav', 'WAV', :hvStorageType, 'Robert''s voice'));
Insert a record that includes an audio clip for Anita Jones into the employee table. Store the audio clip as a BLOB. The source audio clip, which is in a server file, has a user-defined format, a sampling rate of 44.1 KHz, and has two recorded channels.
EXEC SQL BEGIN DECLARE SECTION; long hvStorageType; struct { short len; char data[600]; }hvAudattr; EXEC SQL END DECLARE SECTION; MMDBAudioAttrs *paudiattr; hvStorageType = MMDB_STORAGE_TYPE_INTERNAL; paudioattr=(MMDBAudioAttrs *) hvAudattr.data; strcpy(paudioAttr>cFormat,"cFormatA"); paudioAttr>ulSamplingRate=44100; paudioAttr>usNumChannels=2; hvAudattrs.len=sizeof(MMDBAudioAttrs); EXEC SQL INSERT INTO EMPLOYEE VALUES( '128557', 'Anita Jones', DB2AUDIO( CURRENT SERVER, '/employee/sounds/ajones.aud', :hvStorageType, 'Anita"s voice', :hvAudattr) );