A user displays Robert Smith's image and plays Robert Smith's voice recording. The image is stored in the employee table as a BLOB; the content for the voice recording is in a server file.
What the user does: The user displays the image and plays the voice recording by using an application program that includes the SQL statements that are shown in the following example.
EXEC SQL BEGIN DECLARE SECTION; char hvImg_hdl [251]; char hvAud_hdl [251]; EXEC SQL END DECLARE SECTION; EXEC SQL SELECT PICTURE, /*Get image handle*/ VOICE /*Get audio handle*/ INTO :hvImg_hdl, :hvAud_hdl FROM EMPLOYEE WHERE NAME='Robert Smith'; rc=DBiBrowse( NULL, /*Use default image browser*/ MMDB_PLAY_HANDLE, /*Use handle*/ hvImg_hdl, /*Image handle*/ MMDB_PLAY_NO_WAIT); /*Run browser independently*/ rc=DBaPlay( NULL, /*Use default audio player*/ MMDB_PLAY_HANDLE, /*Use handle*/ hvAud_hdl, /*Audio handle*/ MMDB_PLAY_WAIT); /*Wait for player to end*/ /*before continuing*/ |
What happens: DB2 retrieves the handle of Robert Smith's image and voice recording. Then, in response to the DBiBrowse API, the Image Extender gets the image content associated with the retrieved image handle. The Image Extender retrieves the image content from the database and puts it into a temporary client file for display by an image browser. The NULL parameter indicates that the default image browser for the user's system will be used. The browser will run independently of the calling program, meaning that the calling program will not wait for the image browser to finish before continuing.
In response to the DBaPlay API, the Audio Extender gets the file name of the audio associated with the retrieved audio handle and passes the file name to the audio player. The NULL parameter indicates that the default audio player for the user's system will be used. The calling program will wait for the user to end the audio player before continuing.