Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

Single Piece Write Operation

The entire contents of a buffer can be written in a single piece in one network round trip. The following example writes 10k of data from the local file 'partimage.dat' to part_image column at the offset of 1000.

Dim buffer() as byte

ReDim buffer(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

PartImage.Offset = 1000

FNum = FreeFile

Open "PartImage.Dat" For Binary As #FNum

Get #FNum, , buffer

Part.Edit

amount_written = PartImage.Write(buffer)

Part.Update

Close FNum

The CopyFromFile (OraLob) method writes data directly to a LOB from a local file. The following code is functionally the same as the previous code:

Part.Edit

PartImage.CopyFromFile "PartImage.dat" , 10000, 1000

Part.Update