Recent

Author Topic: ZEOS XML data type.  (Read 151 times)

Eugeniusz Rink

  • Newbie
  • Posts: 1
ZEOS XML data type.
« on: August 12, 2020, 11:28:33 pm »
Hi. We have a problem writing XML to a file. We are using PostgreSQL v.12.x.
There is a field in the table: ezlecenie_xml type: xml. We use Windows10 x64, Lazarus 2.0.10 x32,
ZEOS 7.2.6-stable. So far, the notation as below worked if the data field in the PostgreSQL table had type: bytea.
If the field in the table is xml type, the file.xml file is empty. What are we doing wrong?

Code:
procedure TForm1.Button1Click(Sender: TObject);
var
blob,myFileStream:TStream;
ZapiszPlik:string;
begin
ZapiszPlik:= 'c:\test\file.xml';
blob := DM.ZQZlecenia.CreateBlobStream(DM.ZQZlecenia.FieldByName('ezlecenie_xml'), bmRead);
try
blob.Seek(0, soFromBeginning);
myFileStream := TFileStream.Create(ZapiszPlik, fmCreate);
try
myFileStream.CopyFrom(blob, blob.Size) ;
finally
myFileStream.Free ;
end;
finally
blob.Free ;
end;
end;

 

TinyPortal © 2005-2018