I have problem with saving XML files from postgresql 12.x database to hard drive (XML data type field). I have working procedure with blob data type (binary):
Code: Select all
var
blob,myFileStream:TStream;
SaveFile:string;
begin
SaveFile:='c:\test\test.xml';
blob := Zquery.CreateBlobStream(Zquery.FieldByName('xml_file'), bmRead);
try
blob.Seek(0, soFromBeginning);
myFileStream := TFileStream.Create(SaveFile, fmCreate);
try
myFileStream.CopyFrom(blob, blob.Size) ;
finally
myFileStream.Free ;
end;
finally
blob.Free ;
end;
end;
Regards
Mark