Page 1 of 1
I have truble with TZQuery.CachedUpdates := True in my project
Posted: 06.10.2020, 17:35
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
Re: I have truble with TZQuery.CachedUpdates := True in my project
Posted: 07.10.2020, 08:40
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
Re: I have truble with TZQuery.CachedUpdates := True in my project
Posted: 07.10.2020, 19:04
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.
Re: I have truble with TZQuery.CachedUpdates := True in my project
Posted: 08.10.2020, 06:51
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
Re: I have truble with TZQuery.CachedUpdates := True in my project
Posted: 08.10.2020, 17:27
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?
Re: I have truble with TZQuery.CachedUpdates := True in my project
Posted: 15.10.2020, 06:11
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.
Re: I have truble with TZQuery.CachedUpdates := True in my project
Posted: 15.10.2020, 08:03
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
Re: I have truble with TZQuery.CachedUpdates := True in my project
Posted: 15.10.2020, 18:26
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...