PutBlob

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

PutBlob

Declaration

function PutBlob( sFieldName: String; vpVar: Pointer; iSize: Integer ): LongInt;

Description

Stores a BLOB in a memo field. A BLOB is a binary large object. The maximum size of an Apollo BLOB is 16 megabytes.

 

Elements that contain fixed length strings may be stored and retrieved.

 

If the BLOB resides completely in a file, use Replace to store it in the memo.

 

See the "Using Memo/BLOB Fields" section for important information on BLOB usage with Apollo.

Parameters

sFieldName: The name of the memo field that holds the BLOB.

vpVar: A pointer to a memory object.

iSize: The size of the BLOB.

Return Value

The number of bytes written. If this differs from the size passed in lSize, an error has occurred.

Delphi Example

procedure TForm1.bGetBlobClick(Sender: TObject);

var

 vpVar: Pointer; 

 iBlobSize: Integer; 

 iWriteSize: Integer; 

begin

 iBlobSize := ApTbl.GetBlobLength( 'NOTES' ); 

 Inc( iBlobSize ); 

 bBlobLen.Text := IntToStr( iBlobSize ); 

 GetMem( vpVar, iBlobSize ); 

 if ApTbl.GetBlob( 'NOTES', vpVar ) <> iBlobSize - 1 then 

         edGetBlob.Text := 'GetBlob Failed!' 

 else 

 begin 

         edGetBlob.Text := 'GetBlob Succeeded!'; 

         ApTbl.AppendBlank; 

         iWriteSize := ApTbl.PutBlob( 'NOTES', vpVar, iBlobSize );

         bBlobLen2.Text := IntToStr( iWriteSize ); 

         if iWriteSize <> iBlobSize then 

                 edPutBlob.Text := 'PutBlob Failed!' 

         else 

                         edPutBlob.Text := 'PutBlob Succeeded!'; 

 end; 

 FreeMem( vpVar, iBlobSize ); 

end;

See Also

GetBlob, GetBlobLength, Replace, Using Memo/BLOB Fields