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

Freature requests from users for ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist, mdaems

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

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

Postby mrossij » 13.11.2012, 08:35

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 Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Postby EgonHugeist » 13.11.2012, 09:00

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.
King regards, Michael

You want to help? 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

Postby mrossij » 13.11.2012, 19:33

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 Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Postby EgonHugeist » 13.11.2012, 20:27

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 )):
King regards, Michael

You want to help? 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

Postby mrossij » 13.11.2012, 23:18

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 Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Postby EgonHugeist » 14.11.2012, 00:02

mrossij,

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

You want to help? 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

Postby mrossij » 14.11.2012, 11:57

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

Thanks very much.
Mario.

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Postby EgonHugeist » 14.11.2012, 22:29

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)
King regards, Michael

You want to help? 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

Postby mrossij » 16.11.2012, 19:53

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

Postby mrossij » 19.11.2012, 09:49

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


Return to “Feature Requests”

Who is online

Users browsing this forum: No registered users and 1 guest