適用対象
説明
コピー・バッファ内のLONG
またはLONG
RAW
型のフィールドにバイト配列のデータを追加します。
使用方法
orafield.AppendChunkByte(ByteArray, numbytes)
引数
このメソッドの引数は、次のとおりです。
引数 | 説明 |
---|---|
Byte Array |
指定したフィールドに追加するデータ。 |
numbytes |
コピーするバイト数。 |
備考
AppendChunkByte
メソッドでは、64KBを超えるデータ・フィールドを操作できます。
例
注意: この例は、参照用の不完全なサンプル・コードです。このサンプル・コードに基づいたLONGRAW という完全なVisual Basicサンプルが、OO4Oサンプル・ディレクトリに用意されています。 |
このサンプル・コードでは、AppendChunkByte
メソッドを使用して、データベース内のLONG
RAW
型の列にファイルを読み込む方法を示します。このコードでは、longraw
という列を含んだ表を示すOraDynaset
という有効なダイナセットが存在していると想定しています。
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