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.
[SOLVED] SaveToStream and SaveToFile
[SOLVED] SaveToStream and SaveToFile
Last edited by Prometeus on 03.01.2017, 19:00, edited 2 times in total.
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: SaveToStream and SaveToFile bug
Hello Joao,
hmmm - I assume, you are trying to save a text field? Which driver do you use?
With best regards,
Jan
hmmm - I assume, you are trying to save a text field? Which driver do you use?
With best regards,
Jan
Re: SaveToStream and SaveToFile bug
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.
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.
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: SaveToStream and SaveToFile bug
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
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
Re: SaveToStream and SaveToFile bug
Hello, Jan,
Ok, I'll try to make a small application to show the problem.
Thanks!
Joao Lira.
Ok, I'll try to make a small application to show the problem.
Thanks!
Joao Lira.
Re: SaveToStream and SaveToFile bug
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.
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.
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: [BUG] SaveToStream and SaveToFile
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
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
Re: [SOLVED] SaveToStream and SaveToFile
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.
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.