Oracle Objects for OLE Release 9.2 Part Number A95895-01 |
|
This mechanism is used when the size of the buffer available is smaller than the total amount of data to be written. The total amount of data to be written 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 write 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 write operation. If Status property returns ORALOB_NEED_DATA, the Write method must be called again. This must continue until the amount specified by PollingAmount property has been sent. The piecetype argument of Write method must be set to ORALOB_FIRST_PIECE for the first piece that is sent and last piece Write operation ends with setting piecetype argument to ORALOB_LAST_PIECE. At the end of multiple piece operation, the Status property returns ORALOB_NO_DATA.
The following example writes 102k of data in 10k chunks to the part_image column from the local file 'partimage.dat' at offset of 1000.
Dim buffer() as byte
chunksize = 10000
ReDim buffer(chunksize)
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 "PartImage.Dat" For Binary As #FNum
PartImage.Offset = 1000
PartImage.PollingAmount =102000
remainder = 102000
Part.Edit
Get #FNum, , buffer
amount_written = PartImage.Write(buffer, chunksize,
ORALOB_FIRST_PIECE)
While PartImage.Status = ORALOB_NEED_DATA
remainder = remainder - chunksize
If remainder < chunksize Then
piecetype = ORALOB_LAST_PIECE
chunksize = remainder
Else
piecetype = ORALOB_NEXT_PIECE
End If
Get #FNum, , buffer
amount_written = PartImage.Write(buffer, chunksize, piecetype)
Wend
Close FNum
Part.Update
|
Copyright © 1994, 2002 Oracle Corporation. All Rights Reserved. |
|