[SOLVED] SaveToStream and SaveToFile

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
User avatar
Prometeus
Senior Boarder
Senior Boarder
Posts: 56
Joined: 29.10.2005, 01:25

[SOLVED] SaveToStream and SaveToFile

Post by Prometeus »

Hello,


I've been using the last SVNs and now I realized that when using 'FIELD.SaveToStream' or 'FIELD.SaveToFile' functions in both 'TZQuery' and 'TZReadOnlyQuery' components only the first byte has been saved by them in the stream or file, where 'FIELD' is a BLOB field. I am using Delphi 10.1 Berlin Update 2 now but this problem seem not occur with Delphi 7.

Can this be confirmed?

Thanks!

Joao Lira.
Last edited by Prometeus on 03.01.2017, 19:00, edited 2 times in total.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: SaveToStream and SaveToFile bug

Post by marsupilami »

Hello Joao,

hmmm - I assume, you are trying to save a text field? Which driver do you use?
With best regards,

Jan
User avatar
Prometeus
Senior Boarder
Senior Boarder
Posts: 56
Joined: 29.10.2005, 01:25

Re: SaveToStream and SaveToFile bug

Post by Prometeus »

Hello, Jan,


Yes, the BLOB field is plain text. I am using Zeos with Firebird 3.01. I was writing my first Intraweb application when this problem occured and I thought it had been caused by the latest release of Intraweb until I realized it was a Zeos issue. Is there already a notification about such a bug?

Thank you!


Joao Lira.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: SaveToStream and SaveToFile bug

Post by marsupilami »

Hello Joao,

currently there is no bug report besides yours about this problem. Could you maybe create a small test case? An example program and an example database? That would help me in tracking down the issue. This way I exactly see how your TZConnection is configured and how your database is set up.

With best regards,

Jan
User avatar
Prometeus
Senior Boarder
Senior Boarder
Posts: 56
Joined: 29.10.2005, 01:25

Re: SaveToStream and SaveToFile bug

Post by Prometeus »

Hello, Jan,


Ok, I'll try to make a small application to show the problem.

Thanks!


Joao Lira.
User avatar
Prometeus
Senior Boarder
Senior Boarder
Posts: 56
Joined: 29.10.2005, 01:25

Re: SaveToStream and SaveToFile bug

Post by Prometeus »

Hello, Jan,


As asked I did attach a small sample of the problem. As you will see there is a small Firebird 3.0 database with one table with two fields, one of them is BLOB text. The application has one unit with A 'Memo' and a 'Button'. When the button is clicked the only record is loaded in a 'TZQuery', and next the BLOB field 'ZQ1MEMO_TEST' is saved into a stream and loaded into the 'Memo' using a 'stream' variable. If you check out the database you'll see that the 'MEMO_TEST' field has a string of many characters but only the first one is loaded into the stream and into the 'Memo'. Here is the bug.

Thank you for any light here!

Regards,
Joao Lira.
You do not have the required permissions to view the files attached to this post.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: [BUG] SaveToStream and SaveToFile

Post by marsupilami »

Hello Joao,

I am sorry for my late response but between christmas and new year I had to tae some holidays away from my computer ;)

I think, there is a problem in your code. Using this line, I get a lot more than 1 character shown:
Memo1.Lines.LoadFromStream(memo_stream, TUnicodeEncoding.Create);

Let's not talk about the memory leak in that line - for proper code you would have to create a TUnicodeEncoding before and destroy it later on. ;)

With best regards,

Jan
User avatar
Prometeus
Senior Boarder
Senior Boarder
Posts: 56
Joined: 29.10.2005, 01:25

Re: [SOLVED] SaveToStream and SaveToFile

Post by Prometeus »

Hello, Jan,

First of all, I hope that you and your family have had a really happy holidays time.

I moved from Delphi 7 to Delphi 10.1 Berlin just a couple of months ago and I am still 'browsing' into this 'new world'... I didn't knew about this new way of calling 'LoadFromStream'.

I tested your sugestion (including creating and destroying a 'TUnicodeEncoding' variable to prevent memory leakage) and it worked. Well, fortunately it does not seem like a 'Zeos' fault.

Thank You!


Joao Lira.
Post Reply