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

Multiple Piece Read Operation

This mechanism is used when the size of the buffer available is smaller than the total amount of data to be read. The total amount of data to be read is set by using the PollingAmount (OraLOB/BFILE) property. The Offset (OraLOB/BFILE) property is used only once to set the offset for the first piece read operation. After the first time, it is automatically increased by the size of the previous piece.

The Status (OraLOB/BFILE) property must be checked for success of each piece read operation. If Status property returns ORALOB_NEED_DATA, the Read method must be called again. This must continue until the amount specified by PollingAmount property has been read. At the end of multiple piece operation, the Status property returns ORALOB_NO_DATA.

The following example reads 102k of data in 10k chunks from the part_image column at offset of 1000 to the local file 'image.dat'.

Dim buffer as Variant

Dim buf() As Byte

Set OO4OSession = CreateObject("OracleInProcServer.XOraSession")

Set InvDb = OO4OSession.OpenDatabase("INVDB", "scott/tiger", 0)

Set Part = InvDb.CreateDynaset("select * from part", 0&)

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

FNum = FreeFile

Open "image.dat" For Binary As #FNum

PartImage.offset = 1000

PartImage.PollingAmount = 102000

amount_read = PartImage.Read(buffer, chunksize)

buf = buffer

Put #FNum, , buf

While PartImage.Status = ORALOB_NEED_DATA

amount_read = PartImage.Read(buffer, chunksize)

buf = buffer

Put #FNum, , buf

Wend

Close FNum

The previous lines of code read the part_image LOB data and writes it to image.dat file . At the end of the multiple piece operation, the Status property returns ORALOB_NO_DATA.


 
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