zeosdbo-7.2.14-stable BLOB corrupted from previous version

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
delmar grande
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 23.07.2021, 21:26

zeosdbo-7.2.14-stable BLOB corrupted from previous version

Post by delmar grande »

error character import xml

Code: Select all

TBlobField(qrnotaXML).LoadFromFile('C:\nfe.xml');
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

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

Post 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
delmar grande
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 23.07.2021, 21:26

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

Post 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
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

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

Post 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
delmar grande
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 23.07.2021, 21:26

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

Post 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)
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

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

Post 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
delmar grande
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 23.07.2021, 21:26

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

Post 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; :(
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

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

Post 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.
Post Reply