Oracle® Objects for OLE Developer's Guide 10g Release 1 (10.1) Part Number B10118-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