Skip Headers
Oracle® Objects for OLE Developer's Guide
11g Release 2 (11.2) for Microsoft Windows

Part Number E17727-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

AppendChunk Method

Applies To

OraField Object

Description

Appends data from a string to a LONG or LONG RAW field in the copy buffer.

Usage

orafield.AppendChunk(string)
orafield.DbAppendChunk(string)  

Arguments

The arguments for the method are:

Arguments Description
string Data to append to the specified field.

Remarks

The AppendChunk method allows the manipulation of data fields that are larger than 64 KB.

Examples

Note:

This example cannot be run as is. It requires a defined form named frmChunk.

This example demonstrates the use of the AppendChunk method to read a file into a LONG RAW column of a database. This example expects a valid dynaset named OraDynaset representing a table with a column named longraw. Copy this code into the definition section of a form named frmChunk. Call this procedure with a valid filename.

Sub AppendChunkExample (FName As String)
 
 'Declare various variables.
 Dim NumChunks As Integer, RemChunkSize As Integer
 Dim TotalSize As Long, CurChunk As String
 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
 
  CurChunk = String$(ChunkSize, 32)
 
  'Read a chunk from the file.
  Get #FNum, , CurChunk
 
  'Append chunk to LONGRAW field.
  OraDynaset.Fields("LONGRAW").AppendChunk (CurChunk)
 
 Next I
 
'Complete the add operation and update the database.
OraDynaset.Update
 
 'Close the file.
 Close FNum
 
 frmChunk.MousePointer = DEFAULT
 
End Sub