Page 1 of 1

zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 23.07.2021, 21:43
by delmar grande
error character import xml

Code: Select all

TBlobField(qrnotaXML).LoadFromFile('C:\nfe.xml');

Re: zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 25.07.2021, 18:43
by marsupilami
Hello Delmar,

please tell us more about your environment. What Server do you use? Which compiler version and IDE do you use? Maybe you could come up with a small example application that demonstrates the problem?

Best rgeards,

Jan

Re: zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 27.07.2021, 16:46
by delmar grande
Hello,
Windows 10 pro pt-br
Delphi xe2 32 bits

code

Code: Select all

   ZConnection1.Database := ExtractFilePath(ParamStr(0)) + 'TEST.FDB';
   ZConnection1.Connected := True;
   qrxml.Open;
   qrxml.Edit;
   //qrnotaXML.LoadFromFile('TEST.xml');
   //(qrnotaXML As TWideMemoField).LoadFromFile('TEST.xml');
   TBlobField(qrxmlXML).LoadFromFile('TEST.xml');
   qrxml.Post;
   Memo1.Lines.Add(qrxmlXML.AsString);
follow the example

https://www.mediafire.com/file/6nexhsp9 ... b.zip/file

Re: zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 28.07.2021, 09:41
by marsupilami
Hello Delmar,

I did a quick look at your database. I think the main reason this happens is that it lacks character set information. Please recreate the database using a default character set. Otherwise Zeos will not know hot to read and write data and Firebird will not be able to do the necessary conversins when reading and writing data.
If you can't recreate your database please recreate the blob column with a default character set.

Best regards,

Jan

Re: zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 28.07.2021, 15:23
by delmar grande
Hello, in the version zeosdbo-7.2.4-stable it worked could leave if the blob was charset NONE it would impota without conversion.

I put it like that and I got an error
DID NOT WORK

CHARSET UTF8

Code: Select all

CREATE TABLE XML (
    XML BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET UTF8)

Re: zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 28.07.2021, 16:26
by marsupilami
delmar grande wrote: 28.07.2021, 15:23 Hello, in the version zeosdbo-7.2.4-stable it worked could leave if the blob was charset NONE it would impota without conversion.
Yes - but this use case simply isn't supported by Zeos. If you want to store things in a binary form, use use blob sub_type 0. If you want to store things as text and have the necessary conversions, use blob_sub type 1 but make sure there is a character set attached at all the necessary places.
delmar grande wrote: 28.07.2021, 15:23 I put it like that and I got an error
DID NOT WORK

CHARSET UTF8

Code: Select all

CREATE TABLE XML (
    XML BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET UTF8)
What error did you get? My crystal ball is at the repair shop currently, so I cannot use it to know what happens at your computer.

Regarding your demo application, it has several problems:
  • You didn't specify a connection character set. This will lead to problems.
  • If you fix the above, the file will be loaded as asian characters. This probably is because Zeos generates a TWideMemoField. TWideMemoField expects files to be in UTF16 when loaded with LoadFromFile.
Best regards,

Jan

Re: zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 28.07.2021, 17:25
by delmar grande
Hi, I had to do it like this, to work

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  xmlfile : TStringlist;
begin
   xmlfile := TStringList.Create;
   xmlfile.LoadFromFile('TEST.xml');

   ZConnection1.Database := ExtractFilePath(ParamStr(0)) + 'TEST.FDB';
   ZConnection1.Connected := True;
   qrxml.Open;
   qrxml.Edit;
   //qrnotaXML.LoadFromFile('TEST.xml');
   //(qrnotaXML As TWideMemoField).LoadFromFile('TEST.xml');
   //TBlobField(qrxmlXML).LoadFromFile('TEST.xml');
   qrxmlXML.AsString := xmlfile.Text;
   qrxml.Post;
   Memo1.Lines.Add(qrxmlXML.AsString);
   xmlfile.Free;
end;
I created one

xmlfile : TStringlist; :(

Re: zeosdbo-7.2.14-stable BLOB corrupted from previous version

Posted: 28.07.2021, 18:13
by marsupilami
Yes, that would be the right way to do it. In more modern versions of Delphi one can specify the file encoding in TStringList.LoadFromFile.