Mirror

How to determine the actual size of a blob field in a TTable (Views: 100)


Problem/Question/Abstract:

How to determine the actual size of a blob field in a TTable

Answer:

Here is a function GetBlobSize that returns the size of a given blob, memo, or graphic field. An example of calling it follows:

function GetBlobSize(Field: TBlobField): Longint;
begin
  with TBlobStream.Create(Field, bmRead) do
  try
    Result := Seek(0, 2);
  finally
    Free;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  {This sets the Edit1 edit box to display the size of a memo field named Notes}
  Edit1.Text := IntToStr(GetBlobSize(Notes));
end;

<< Back to main page