Page 1 of 1

Zquery and filters

Posted: 05.05.2010, 01:09
by iru
Gentlefolk,

Raised this in the lazarus.database forum, no responses.

Using Laz 0.9.28, ZEOS 6.6.6 AND 7.0, Win XP SP3.

Using DBGrid-datasource-ZQuery-ZConnection.
Everyting compiles and connects to the database OK.

I have a complex database program for entering results data for athletic meetings. For a sprint event when the user clicks on a "race-heat" button the program generates 8 rows of data for a FireBird database table.

Results display OK in DBGrid (8 rows/lanes sequentially numbered, etc).

Click on another "race-heat" buttons and 8 rows of data are created Ok in the database/buffer for the new heat.

Click on the original "race-heat" again, if there are records for that "race-heat" do not create any more records but apply a filter to the ZQuery to only display (in the DBgrid) rows for the original "race-heat".

At this point things go wrong and the last row is dropped or in some cases what appears to be the first row of the same heat overwrites the last row.

I have created a small test program (attached) which appears to illustrate the problem:

Click on buttons 1-2-3, which check for any records for button 1-2-3 , if no records exist (RecordCount = 0) create 5 rows of data, in each case 5 rows of data are displayed in the DBGrid.

Click on Button1 again,

Apply a filter (Colum "ID" = 1) and RecordCount = 4 and four records are displayed.

Same for buttons 2 and 3.

If I remove the filter "ALL" records are displayed. Well sort of, I get

Heat 1, 1-2-3-4-blank
Heat 2, 1-2-3-4-blank
Heat 3, 1-1-2-3-4
If I re-apply the filter for heat 3 I geta a display 1-2-3-4-1

All of the above results are ugly, it would appear that the filter/data-refresh mechanism in ZQuery is not working correctly.

Note ZUpdateSQL is attached to ZQuery but not used.
File test7-fb-sql.txt is the database ddl.
Have tried the aths program using ZEOS 6.6.6 and 7.0.

Any comments, suggestions?????

Ian

Posted: 07.05.2010, 03:31
by iru
Gentlefolk,

Some further work indicates that this problem is fixed in ZEOS 7.0.

Ian

Posted: 12.05.2010, 23:47
by mdaems
Do you also know where it was fixed? (revision) Maybe I can backport the fix to 6.6-patches.

Mark