1. Computing & Technology

Discuss in my forum

Determine the actual size of a Blob field in a Table

By , About.com Guide

Here is a function GetBlobSize that returns the size of a given blob, memo, or graphic field.

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

{ Usage: }
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;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Path Shortener: c:\AB\C...DE\F.ghi
« TMemo printing

©2012 About.com. All rights reserved.

A part of The New York Times Company.