Page 1 of 1

Update only the changed fields

Posted: 01.02.2019, 15:09
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.

Re: Update only the changed fields

Posted: 03.02.2019, 17:47
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

Re: Update only the changed fields

Posted: 05.02.2019, 13:29
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.

Re: Update only the changed fields

Posted: 05.02.2019, 17:47
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

Re: Update only the changed fields

Posted: 11.02.2019, 08:26
by Fr0sT
Dataset/DB property DSProps_KeyFields lets you manually define fields which will be considered "key". I use this tech for views