I have truble with TZQuery.CachedUpdates := True in my project

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
ash71
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 04.05.2020, 13:05

I have truble with TZQuery.CachedUpdates := True in my project

Post by ash71 »

Hello All. Latest Lazarus Win32. freetds or OleDB, msql

With ZQuery.CachedUpdates := true;
My project crashes when ZQuery.ApplyUpdates with message … "0 recod(s) updated. Only one record should have been updated."

In my case i insert new record, then recalculate all records in dataset. After that ZQuery.ApplyUpdates ... and the message appear.

In unit ZDbcCachedResultSet.pas, procedure TZAbstractCachedResultSet.PrepareRowForUpdates;
i found that my new record with .UpdateType = utInserted becomes FUpdatedRow.UpdateType := utModified; // program row:531

Thank to all
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: I have truble with TZQuery.CachedUpdates := True in my project

Post by marsupilami »

Hello,

could you try to supply a little example that raises this error? Otherwise we have to guess what goes on and we might do the wrong guesses.
Best regards,

Jan
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 766
Joined: 18.11.2018, 17:37
Location: Hungary

Re: I have truble with TZQuery.CachedUpdates := True in my project

Post by aehimself »

What exactly recalculating all records mean? Can you do that AFTER the ApplyUpdates?

If you are moving the cursor from the inserted row, that will result an immature post. Once you modify the inserted record, it's possible that it will be considered as modified when you reach .ApplyUpdates.

An other thing you can try is NOT to use .CachedUpdates, only connection transactions. I had my fair share of trouble with .CachedUpdates and decided not to use this feature at all as it was giving only a minor performance increase compared to transactions / transactions & cachedupdates.
Delphi 12.1, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmariadb.dll 3.3.8
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.13
- MSSQL 2012, 2019; sybdb.dll FreeTDS_2435
- SQLite 3.45.2
ash71
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 04.05.2020, 13:05

Re: I have truble with TZQuery.CachedUpdates := True in my project

Post by ash71 »

hi,
I think that all inserted records in cached state before ApplyUpdates must remain Inserted.

In my case:
1. the dataset is in cached state;
2. do insert of new record with default values;
3. do post
4. recalculate values (some fields) in dataset with first, edit, supply values, post, next.. to the end
5. AppluUpdate (in this point only update statement is trying to send to the server)
6. Error is raised
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: I have truble with TZQuery.CachedUpdates := True in my project

Post by EgonHugeist »

Hi ash71,

1.
please reply here: viewtopic.php?f=50&t=125819
we are waiting for an test to resolve the ticket: https://sourceforge.net/p/zeoslib/tickets/438/

2. Is this regression related to: https://sourceforge.net/p/zeoslib/tickets/446/ ??
could you provide a simple app which demonstrates the problem?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: I have truble with TZQuery.CachedUpdates := True in my project

Post by EgonHugeist »

Double post,

please update. I added a a dbc test for that report see https://sourceforge.net/p/zeoslib/code-0/6957/. Yet i had no time to port the test to to the dataset level. However please test and report your findings.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ash71
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 04.05.2020, 13:05

Re: I have truble with TZQuery.CachedUpdates := True in my project

Post by ash71 »

Hi there,
Today i reinstalled zeoslib and find that in my cases with Cached Updates all things works perfectly. Thanks.
I found that in unit ZFunctionsStrings needs to add Math in unit section, related to compile error in row 282

d[i, j] := Min(
Min(d[i-1,j]+1, // deletion
d[i,j-1]+1), // insertion
d[i-1,j-1]+Cost); // substitution

Best regards,
ash
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: I have truble with TZQuery.CachedUpdates := True in my project

Post by EgonHugeist »

Fixed as suggested (my FPC's didn't show that compilation error). Thanks.
However please take attantion to viewtopic.php?f=50&t=125819 or i'll close the ticket...
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Post Reply