Update only the changed fields

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
duzenko
Senior Boarder
Senior Boarder
Posts: 53
Joined: 17.06.2009, 11:24

Update only the changed fields

Post by duzenko »

Hi, I wonder if it possible to only include the actually changed fields in TZGenericCachedResolver.FormUpdateStatement?
My problem is that my program is being used in the multi-user environment and sometimes users change the same record (but different fields) from different connections.
Since all fields are being rewritten only one change persists.
I wonder if it's possible to check if the field has been changed and only include the relevant fields.
I think it should also be great for speed.
FWIW I'm on 7.1.3 and use TZQuery -> TDatasource -> TDBEdit's in this particular place. The DB is Firebird 2.5.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: Update only the changed fields

Post by marsupilami »

Hello,

I am not entirely sure about Zeos 7.1 but in Zeos 7.2 TZQuery has the property UpdateMode and if you set it to umUpdateChanged that should work as you expect it to work.

Best regards,

Jan
duzenko
Senior Boarder
Senior Boarder
Posts: 53
Joined: 17.06.2009, 11:24

Re: Update only the changed fields

Post by duzenko »

Thank you
It seems to rely exclusively on the primary keys in DB (I mean the sql where clause)
Is there any way I can pass the index field name via TZTable parameters? I don't have the actual primary key in the DB for that table.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: Update only the changed fields

Post by marsupilami »

Hello duzenko,

you could use UpdateMode umWhereAll. But that contradicts your idea to mix changes from different work places. umUpdateChanged only makes sense if you have a primary key defined.
duzenko wrote:Is there any way I can pass the index field name via TZTable parameters? I don't have the actual primary key in the DB for that table.
With current versions of Zeos you can't. Define a primary key.

Best regards,

Jan
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

Re: Update only the changed fields

Post by Fr0sT »

Dataset/DB property DSProps_KeyFields lets you manually define fields which will be considered "key". I use this tech for views
Post Reply