Search code examples
delphiblobadvantage-database-server

Saving blob field from Advantage DB to file


I have problems retrieving a blob field containing images, then saving it to file.
The downloaded file does not seem to be in the correct format; if I open it with a hex editor it contains the word @R_BLOB@

What could be wrong?

bg: = TAdsBlobStream.Create (adsQuery1.FieldByName ('PAGE') as TBlobField, bmReadWrite);
f: = TMemoryStream.create;
bg.Position: = 0;
f.CopyFrom (bg, bg.size);
f.SaveToFile ('c: \ tmp \ db \ img \' + IntToStr (n) + '. jpg');
f.free;

Thanks


Solution

  • The initial text @R_BLOB@ depended on the type of table set in the properties TableType of the component TadsQuery, setting it to ttAdsCDX, export work.

    Thanks all.