GetBlob

<< Click to Display Table of Contents >>

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

GetBlob

Declaration

function GetBlob( sFieldName: String; vpVar: Pointer ): LongInt;

Description

Retrieves a BLOB that was stored 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.

 

BLOBS are stored in memo fields either with PutBlob or Replace.

 

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 pre-initialized memory object of the correct size. Use GetBlobLength to determine that size.

Return Value

The size of the BLOB as a long integer. If this differs from the size returned by GetBlobLength, an error has occurred.

Delphi Example

procedure TForm1.bGetBlobClick(Sender: TObject);

var

 vpVar: Pointer; 

 lBlobSize: LongInt; 

 lWriteSize: LongInt; 

begin

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

 Inc( lBlobSize ); 

 bBlobLen.Text := IntToStr( lBlobSize ); 

 GetMem( vpVar, lBlobSize ); 

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

         edGetBlob.Text := 'GetBlob Failed!' 

 else 

 begin 

         edGetBlob.Text := 'GetBlob Succeeded!'; 

         ApTbl.AppendBlank; 

         lWriteSize := ApTbl.PutBlob( 'NOTES', vpVar, lBlobSize ); 

         bBlobLen2.Text := IntToStr( lWriteSize ); 

         if lWriteSize <> lBlobSize then 

                 edPutBlob.Text := 'PutBlob Failed!' 

         else 

                 edPutBlob.Text := 'PutBlob Succeeded!'; 

 end; 

 FreeMem( vpVar, lBlobSize ); 

end;

See Also

GetBlobLength, PutBlob, Replace, Using Memo/BLOB Fields