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

Freature requests from users for ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

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

Post 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.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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.
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
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Post 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.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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 )):
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
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Post 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.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

mrossij,

no problem.
Hmm what about a difine for Zeos.inc? That could be commented by default and you simply uncomment it?
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
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Post by mrossij »

Oh, thanks for the idea!.
It would be much better.
How should I do?

Thanks very much.
Mario.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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)
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
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Post by mrossij »

I'm downloading now the sources from SVN/testing.
As soon as I can, do the tests.

See you soon.
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Post by mrossij »

Egon,
from Saturday to Sunday I tried the changes you made and is.... perfect!.
Thank you for your availability, really great!
Post Reply