Oracle® Objects for OLE Developer's Guide 10g Release 1 (10.1) Part Number B10118-01 |
|
'This example is for use with ASP (Active Server Pages)
<%@ LANGUAGE = VBScript %>
<%Response.ContentType = "image/JPEG"%>
<%
Dim OraDatabase, Oradynaset
Dim Chunksize, BytesRead, CurChunkEx
'This assumes a pool of database connections have been created in the global.asa
Set OraDatabase = OraSession.getDatabaseFromPool(10)
'This assumes a table called "art_gallery" and
'displays JPEG images stored in the table
Set OraDynaset = OraDatabase.CreateDynaset("select art from art_gallery where artist = 'Picasso'", 0)
BytesRead = 0
'Reading in 32K chunks
ChunkSize= 32768
Do
BytesRead = OraDynaset.Fields("picture").GetChunkByteEx(CurChunkEx,
i * ChunkSize, ChunkSize)
if BytesRead > 0 then
Response.BinaryWrite CurChunkEx
end if
Loop Until BytesRead < ChunkSize
'Cleanup, remove all local references
Set OraDynaset = Nothing
Set Oradatabase = Nothing
%>