Oracle Objects for OLE Release 9.2 Part Number A95895-01 |
|
The entire contents of a buffer can be read in a single piece in one network round trip. The following example reads 10k of data from the part_image column at an offset of 1000 to the local file image.dat.
Dim buffer as Variant
Dim buf() As Byte
chunksize = 10000
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
amount_read = PartImage.Read(buffer,10000)
buf = buffer
Put #FNum, , buf
Close FNum
The CopyToFile (OraLob/BFILE) method writes data directly to a local file from a LOB. The following code is functionally the same as the previous code:
PartImage.CopyToFile "image.dat" , 10000, 1000
|
Copyright © 1994, 2002 Oracle Corporation. All Rights Reserved. |
|