ZQuery and Refresh

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

ZQuery and Refresh

Post by aebi »

Hello,

in Delphi 7 and Zeos 6.5.1 I often use "<ZQuery>.Refresh" to refresh the data displayed, for example in a DBGrid (Database is PostgreSQL 8.4).

After changing to Delphi XE 10, Zeos 7.14 and PostgreSQL 9.5, I have some problems doing this again.
Debugging leads to the unit "ZAbstractRODataset" -> "MoveRecNo"; the call of "Resync" (which belongs to "TDataSet") results in an access violation.
But : with some tables in the database, it works, with others not - all of them uses simple queries with only one table.

The client encoding for postgres dabase is set to "UTF-8".

Maybe some one has an idea about this ?

Thank You,
with best regards
Andreas
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: ZQuery and Refresh

Post by marsupilami »

Hello aebi,

could you try what happens if yoiu use the current Zeos 7.2 Beta? It has lots of improvements and should already be more stable than Zeos 7.1. Please get it via SVN from http://svn.code.sf.net/p/zeoslib/code-0 ... esting-7.2.

If the error persists, it helps very much to have a sample program that triggers the error.

With best regards,

Jan
Last edited by marsupilami on 13.07.2016, 21:22, edited 1 time in total.
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

Re: ZQuery and Refresh

Post by aebi »

Hello Jan,

I just checked out 7.2 and will do some test.

Thank You,
best regards
Andreas
seiraya
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 31.05.2006, 05:56

Re: ZQuery and Refresh

Post by seiraya »

Hi,

I do have same problem TZQuery.Refresh, it produce access violation.
I Use 7.1.4-stable, XE7 with MySQL

Regards
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: ZQuery and Refresh

Post by marsupilami »

Hello seiraya,

could you please try using the current Zeos 7.2 version from SVN? We will (soon) release this one as the stable version. It has a lot of bugfixes, speed improvements and also new features.
With best regards,

Jan
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

Re: ZQuery and Refresh

Post by aebi »

Hello again,
and the best wishes for the new year !

some time ago, I posted about the problem with "refresh"; meanwhile I had the chance to test again, therefore I checked out the version 7.2 (SVN revision 3892).

First : the problem seems to be the same (unit ZDatasetUtils, "FetchFromResultSet", "Current.DataType" is "ftWideString"; I'm using Delphi XE 10, Windows 10 (64 bit) and Postgresql 9.6).

Second : "TZPostgreSQLConnection.SetTransactionIsolation" (in unit ZDbcPostgreSql) seems to have an error : the syntax for "SET SESSION CHARACTERISTICS AS TRANSACTION" must have "ISOLATION LEVEL", not just only "ISOLATION" (SQL-Syntax for Postgresql - at least in version 9.6).
Should I post this also in the 7.2 - forum ?

with best regards
Andreas
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

Re: ZQuery and Refresh

Post by aebi »

Hello (again...),
maybe it's helpfull : the query with the refresh-problem has an "AfterOpen"-Event, this event changes display-labels, adds "OnGetText"-Events to some fields and - this is some how the problem - changes the index (FieldByName ('XY').Index := n).
Without changing the index, the refresh is no problem.
With channging less then (in my special case) five indexes, the refresh is also no problem.
With changing more then five indexes, there is the problem with the access violation.

with best regards
Andreas
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: ZQuery and Refresh

Post by marsupilami »

Hello Andreas,

I will look into the PostgreSQL problem. It seems, I introduced that bug...

Regarding the refresh problem - could you prepare a small example project, maybe including a small database or the script for the database? That would make debugging this issue a lot more easy.

With best regards,

Jan
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

Re: ZQuery and Refresh

Post by aebi »

Hello Jan,

I could reduce the problem to the following :

- (with SQL) : "create table refreshdata (no Integer, info_data Char (50))"
- (with SQL) : "insert into refreshdata values (1, 'info 1')"

- create a delphi project with ZConnection to the database and ZQuery
- ZQuery.SQL.Text := 'SELECT * FROM refreshdata ORDER BY no'
- ZQuery.AfterOpen := MyAfterOpen;
- MyAfterOpen (DataSet: TDataSet) with "ZQuery.FieldByName ('info_data').Index := 0;"
- ZQuery.Open;

--> "ZQuery.Refresh;" (I used a button-click to trigger) generates the acess violation.
This is in function "SysReallocMem", the last Zeos-procedure is "ZDbcCache.TZRowAccessor.SetUnicodeString(1, 'info 1')"

My Environment : Windows 10 (64 Bit); Delphi XE 10, Zeos 7.14, Postgres 9.6 (32 Bit).

I also tested Zeos 7.2 (see post before) and also Postgres 9.4 / 9.5 (32 Bit).

The application is compiled as 32-Bit-Application.


with best regards
Andreas
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: ZQuery and Refresh

Post by marsupilami »

Hello Andreas,

thank you. I will try to reproduce the bug.
Regards,

Jan
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: ZQuery and Refresh

Post by marsupilami »

Hello Andreas,

fixing this bug seems to be harder than I thought. Just wanted to let you know, it is not forgotten.
Best regards,

Jan
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

Re: ZQuery and Refresh

Post by aebi »

Thank You, Jan !

For the moment (in that case) I can do "<Query>.Close", then "<Query>.Open", but if Refresh will work, it would by fine.

with best regards
Andreas
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: ZQuery and Refresh

Post by marsupilami »

Hello Andreas,

the problem has been fixed im the current SVN revision of Zeos 7.2.
With best regards,

Jan
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

Re: ZQuery and Refresh

Post by aebi »

Ok, thank You, Jan, I will check out (probably the next days) and try it.

with best regards
Andreas
Post Reply