Stefan van Roosmalen
asked on
Lazarus: saving BLOBs from Sybase database
Hi there,
I am trying to save files which are stored in BLOB fields in a Sybase database.
The routine below seems to work, files are being saved in my folder, but when opening them they seem to be corrupt. For example when I open a Word or Excel file it needs to be repaired (by Office) before I can read the contents.
Could you please help me out? Notice: I am using Lazarus (@Windows), not all Delphi stuff is available.
Kind Regards,
Stefan
I am trying to save files which are stored in BLOB fields in a Sybase database.
The routine below seems to work, files are being saved in my folder, but when opening them they seem to be corrupt. For example when I open a Word or Excel file it needs to be repaired (by Office) before I can read the contents.
procedure TForm1.saveBlobs;
var tmpFilename: String;
tmpList: TStringList;
begin
Query1.First;
While not Query1.Eof do begin
tmpFilename := prgPath + '_output\' + Query1.FieldByName('DOCU_ORG_FILENAME').AsString;
tmpList := TStringList.Create;
tmpList.Append(Query1.FieldByName('DOCU_DOCUMENT').AsVariant);
tmpList.SaveToFile(tmpFilename);
tmpList.Free;
Query1.Next;
end;
end;
Could my routine be the root cause of these corruptions?Could you please help me out? Notice: I am using Lazarus (@Windows), not all Delphi stuff is available.
Kind Regards,
Stefan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You have helped me with the right direction... thanks!
ASKER
Error: Identifier not found "CreateBlobStream"
But I have found the trick:
Open in new window