TIBCLoader and Blob Fields

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Denis WILLARD
Posts: 3
Joined: Fri 23 Aug 2013 12:07

TIBCLoader and Blob Fields

Post by Denis WILLARD » Mon 02 Sep 2013 11:32

IBDac 5.0.2 - Delphi 7
Is it possible when using a TIBCLoader, to load data in a BLOB field with a LoadFromfile ?

AndreyZ

Re: TIBCLoader and Blob Fields

Post by AndreyZ » Tue 03 Sep 2013 08:33

TIBCLoader does not work with fields, therefore there is no direct way to use the LoadFromFile method. As a workaround, you can use the code similar to this one:

Code: Select all

procedure TForm1.IBCLoader1PutData(Sender: TDALoader);
var
  bt: TBytes;
  str: TFileStream;
begin
  str := TFileStream.Create('filename', fmOpenRead);
  try
    SetLength(bt, str.Size);
    str.Position := 0;
    str.Read(bt[0], str.Size);
    Sender.PutColumnData(0, 1, bt); // where zero column corresponds to a blob field
  finally
    str.Free;
  end;
end;

Denis WILLARD
Posts: 3
Joined: Fri 23 Aug 2013 12:07

Re: TIBCLoader and Blob Fields

Post by Denis WILLARD » Wed 04 Sep 2013 17:24

Thank you,
it is exactly what I needed !

AndreyZ

Re: TIBCLoader and Blob Fields

Post by AndreyZ » Thu 05 Sep 2013 05:59

I am glad I could help. If any other questions come up, please contact us.

Post Reply