Oracle® Objects for OLE Developer's Guide 11g Release 2 (11.2) for Microsoft Windows Part Number E17727-03 |
|
|
PDF · Mobi · ePub |
Appends data from a byte array to a LONG
or LONG
RAW
field in the copy buffer.
orafield.AppendChunkByte(ByteArray, numbytes)
The arguments for the method are:
Arguments | Description |
---|---|
Byte Array |
Data to append to the specified field. |
numbytes |
Number of bytes to copy. |
The AppendChunkByte
method allows the manipulation of data fields that are larger than 64 KB.
Note:
This is an incomplete code sample, provided for your reference. A complete Visual Basic sample calledLONGRAW
that is based on this code sample, is provided in the OO4O samples directory.This sample code demonstrates the use of the AppendChunkByte
method to read a file into a LONG
RAW
column of a database. This code expects a valid dynaset named OraDynaset
representing a table with a column named longraw
.
Sub AppendChunkByteExample (FName As String) 'Declare various variables. Dim NumChunks As Integer, RemChunkSize As Integer Dim TotalSize As Long, CurChunkByte() As Byte Dim I As Integer, FNum As Integer, ChunkSize As Integer 'Set the size of each chunk. ChunkSize = 10240 frmChunk.MousePointer = HOURGLASS 'Begin an add operation. OraDynaset.AddNew 'Clear the LONGRAW field. OraDynaset.Fields("LONGRAW").Value = "" 'Get a free file number. FNum = FreeFile 'Open the file. Open FName For Binary As #FNum 'Get the total size of the file. TotalSize = LOF(FNum) 'Set number of chunks. NumChunks = TotalSize \ ChunkSize 'Set number of remaining bytes. RemChunkSize = TotalSize Mod ChunkSize 'Loop through the file. For I = 0 To NumChunks 'Calculate the new chunk size. If I = NumChunks Then ChunkSize = RemChunkSize End If ReDim CurChunkByte(ChunkSize) 'Read a chunk from the file. Get #FNum, , CurChunkByte 'Append chunk to LONGRAW field. OraDynaset.Fields("LONGRAW").AppendChunkByte (CurChunkByte) Next I 'Complete the add operation and update the database. OraDynaset.Update 'Close the file. Close FNum frmChunk.MousePointer = DEFAULT End Sub