Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

Example: Multiple piece-wise Read of a LOB

Schema Description

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim OraDynaset As OraDynaset

Dim PartImage As OraBlob

Dim chunksize As Long

Dim AmountRead As Long

Dim buffer As Variant

Dim buf() As Byte

'Create the OraSession Object.

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

'Create the OraDatabase Object by opening a connection to Oracle.

Set OraDatabase = OraSession.OpenDatabase("ExampleDb",

"scott/tiger", 0&)

'Create the OraDynaset Object.

Set OraDynaset = OraDatabase.CreateDynaset("select * from part", 0&)

'Get OraBlob from OraDynaset

Set PartImage = OraDynaset.Fields("part_image").Value

'Set Offset and PollingAmount property for piecewise Read operation

PartImage.offset = 1

PartImage.PollingAmount = PartImage.Size

chunksize = 50000

'Get a free file number

FNum = FreeFile

'Open the file

Open "image.dat" For Binary As #FNum

'Do the first read on PartImage, buffer must be a variant

AmountRead = PartImage.Read(buffer, chunksize)

'put will not allow Variant type

buf = buffer

Put #FNum, , buf

' Check for the Status property for polling read operation

While PartImage.Status = ORALOB_NEED_DATA

AmountRead = PartImage.Read(buffer, chunksize)

buf = buffer

Put #FNum, , buf

Wend

Close FNum


 
Oracle
Copyright © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback