Subject | Re: [IBO] Store an Restore a file from a BLOB field |
---|---|
Author | skander_sp |
Post date | 2005-01-19T11:51:06Z |
Ok, thanks...
I now have used Assign() and AssignTo() methods to put and get from a
file...
BUT...
to store, I think it work well (some is stored in the field BLOB), but
for get, I recover a empty file. Look loke the BLOB field is not
automatically loaded at memory, then have none to store at file...
here the code
......
var
Stream: TFileStream;
begin
inherited;
Stream:=TFileStream.Create('C:\TRY.DOC',fmOpenRead);
BookStore.FieldByName('BFILE').Assign(Stream);
Stream.Free;
end;
...... and this fail...
var
Stream: TFileStream;
begin
inherited;
Stream:=TFileStream.Create('C:\RECOVER.DOC',fmCreate);
BookStore.FieldByName('BFILE').AssignTo(Stream);
Stream.Free;
end;
I now have used Assign() and AssignTo() methods to put and get from a
file...
BUT...
to store, I think it work well (some is stored in the field BLOB), but
for get, I recover a empty file. Look loke the BLOB field is not
automatically loaded at memory, then have none to store at file...
here the code
......
var
Stream: TFileStream;
begin
inherited;
Stream:=TFileStream.Create('C:\TRY.DOC',fmOpenRead);
BookStore.FieldByName('BFILE').Assign(Stream);
Stream.Free;
end;
...... and this fail...
var
Stream: TFileStream;
begin
inherited;
Stream:=TFileStream.Create('C:\RECOVER.DOC',fmCreate);
BookStore.FieldByName('BFILE').AssignTo(Stream);
Stream.Free;
end;
--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@i...> wrote:
> No utility required. Just use the Assign() and AssignTo() methods
of the
> fields and make use of either TFileStream or TMemoryStream as
needed. This
> is more of a Delphi question really.
>
> Jason Wharton
>