Page 1 of 1

[solved] A question and a proposed modification to the code

Posted: 13.11.2012, 08:35
by mrossij
Hi,
use Delphi since version 1 (almost 20 years) and the Zeos library is the library that I loved most. Thanks to Zeos, I was able to migrate my applications from BDE.
I have a small question for the group that writes and maintains Zeos.
In the unit ZDbcGenericResolver, in the procedure TZGenericCachedResolver.PostUpdates (...., there is this statement:
      if (lValidateUpdateCount)
      and (lUpdateCount <> 0) then ....
that, in my opinion, should be corrected:
      if (lValidateUpdateCount)
      and (lUpdateCount> 1) then ....
because, using the TzTable, often, happens that only 1 record meets the criteria and, in this case, the program exits with the exception:
0 record (s) updated. Only one record Should have been updated.
Every, when upgrading libraries Zeos, I have to change this line.
My question is:
where am I wrong?, and if I'm not mistaken you can accept my change?
Thanks to all the wonderful staff who gave us this wonderful jewel.
Mario Rossi.

Posted: 13.11.2012, 09:00
by EgonHugeist
mrossij,

hi thank's for asking instead of a bugreport (:

The solution is quiet simple:

TZDataSetComponent.Properties['ValidateUpdateCount'] := '-1' or 'OFF' or 'FALSE';

Each TZQuery, TZTable, TZReadOnlyQuery is checking that property first. Mostly the user doesn't change that behavior, so Zeos raises an exception because we expect an optimal ((: updatecount of 1.

Posted: 13.11.2012, 19:33
by mrossij
Hi EgonHugeist, thanks for the reply.
Unfortunately, I can not apply your advice.
As I enter the property ?
For example, if I have a TZtable tbOrders, how set the required property?:
I do not understand how to set it.
(tbOrders.properties....... )

Tnks in advance.

Posted: 13.11.2012, 20:27
by EgonHugeist
mrossij,

TZReadOnlyQuery/TZTable/TZQuery.Properties = TStrings.

Click in your property editor on that property and type in:

ValidateUpdateCount=-1
or
ValidateUpdateCount=OFF
or
ValidateUpdateCount=FALSE

Hope you understand me now )):

Posted: 13.11.2012, 23:18
by mrossij
Very well, it works.
However, I think that I will continue to modify the source of the unit ZdbcGenericResolver because it is more easier for me.
My projects have dozens of tables into "Data Modules" and forms and I should specify this properties for each dataset.
Anyway, thanks for your appreciated collaboration and help.

Posted: 14.11.2012, 00:02
by EgonHugeist
mrossij,

no problem.
Hmm what about a difine for Zeos.inc? That could be commented by default and you simply uncomment it?

Posted: 14.11.2012, 11:57
by mrossij
Oh, thanks for the idea!.
It would be much better.
How should I do?

Thanks very much.
Mario.

Posted: 14.11.2012, 22:29
by EgonHugeist
mrossij,

you can do this on your side. I did it now on Zeos side.

I've added a {$IFDEF WITH_VALIDATE_UPDATE_COUNT} define to the Zeos.inc

Patch done Rev. 2007 \testing (SVN)

Posted: 16.11.2012, 19:53
by mrossij
I'm downloading now the sources from SVN/testing.
As soon as I can, do the tests.

See you soon.

Posted: 19.11.2012, 09:49
by mrossij
Egon,
from Saturday to Sunday I tried the changes you made and is.... perfect!.
Thank you for your availability, really great!