Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

Example: Using GetChunkByteEx to Retrieve a LONG RAW

This example demonstrates the use of GetChunkByteEx to retrieve a LONG RAW column of a database and save it into a file. This example expects a valid dynaset named OraDynaset representing a table with a column named 'type_longraw'. Copy and paste this code into the definition section of a form. Call this procedure with a valid filename.

Sub GetChunkByteExExample (FName As String)

'Declare various variables

Dim bytesread As Integer, ChunkSize As Long ,

bytearr() as byte

Dim I As Integer, FNum As Integer, CurChunk

'Set the size of each chunk

ChunkSize = 10240

frmChunk.MousePointer = HOURGLASS

'Get a free file number

FNum = FreeFile

'Open the file

Open FName For Binary As #FNum

I = 0

'Loop through all of the chunks

'Oracle does not return the size of columns > 64KB.

'We should loop until the length of our block is

'less than we asked for.

Do

bytesread =

OraDynaset.Fields("type_longraw").GetChunkByteEx(CurChunk,

I * ChunkSize, ChunkSize)

'redim byte array

redim bytearr(bytesread - 1)

bytearr = CurChunk

Put #FNum, , bytearr 'Write chunk to file.

I = I + 1

Loop Until bytesread < ChunkSize

'Close the file.

Close FNum

frmChunk.MousePointer = DEFAULT

End Sub