Oracle Objects for OLE
Release 9.0.1

Part Number A90173-01

Home

Book List

Contents

Master Index

Feedback

GetChunkByte Method Example

This example demonstrates the use of GetChunkByte 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 longraw. Copy and paste this code into the definition section of a form. Call this procedure with a valid filename.

Sub GetChunkByteExample (FName As String)

'Declare various variables

Dim CurSize As Integer, ChunkSize As Long

Dim I As Integer, FNum As Integer, CurChunk() As Byte

'Set the size of each chunk

ChunkSize = 10240

'Redim CurChunk Array

ReDim CurChunk(ChunkSize)

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

CurSize = OraDynaset.Fields("type_longraw").GetChunkByte(CurChunk(0), I * ChunkSize, ChunkSize)

If CurSize < ChunkSize Then

ReDim CurChunk(CurSize)

CurSize = OraDynaset.Fields("type_longraw").GetChunkByte(CurChunk(0), I * ChunkSize, CurSize)

End If

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

I = I + 1

Loop Until CurSize < ChunkSize

'Close the file.

Close FNum

frmChunk.MousePointer = DEFAULT

End Sub


 
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.

Home

Book List

Contents