Delphi Examples: DbiGetBlob

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiGetBlob

Return to chapter overview

Display the specified field's memo.

The field specified in BlobIndex must be a valid memo blob and the BlobBuffer must be allocated. This example uses the following input:

 fDbiGetBlob(BIOLIFE_TABLE, BIOLIFE_TABLE.FieldByName('Notes').Index,

   BlobBuffer);

 

The procedure is defined as:

procedure fDbiGetBlob(InDataSet: TBDEDataSet; BlobIndex: Word; var BlobInfo: String);

var

NumRead: LongInt;

begin

 // Parameter iField of DbiOpenBlob requires an ordinal field number

 Inc(BlobIndex);

 InDataSet.UpdateCursorPos;

 Check(DbiOpenBlob(InDataSet.Handle, InDataSet.ActiveBuffer, BlobIndex, dbiReadOnly));

 Check(DbiGetBlobSize(InDataSet.Handle, InDataSet.ActiveBuffer, BlobIndex, NumRead));

 SetLength(BlobInfo, NumRead);

 Check(DbiGetBlob(InDataSet.Handle, InDataSet.ActiveBuffer, BlobIndex, 0,

   NumRead, PChar(BlobInfo), LongInt(NumRead)));

 Check(DbiFreeBlob(InDataSet.Handle, InDataSet.ActiveBuffer, BlobIndex));

end;