Client table update on dataset update

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
oakley
Posts: 2
Joined: Sat 05 Aug 2006 17:26

Client table update on dataset update

Post by oakley » Thu 11 Apr 2019 09:24

Hi,

I am playing around a bit with unidac.
I try to program a little test with a simple table component on mariadb.
Now, if this program runs on 2 different clients and one of them deletes, updates or modifes a dataset, is it possible to get an updated view in the table component directly?

Is the dataset manipulation firing any event the I can check for to update the other client?

Best regards...

Mirko

ViktorV
Devart Team
Posts: 2661
Joined: Wed 30 Jul 2014 07:16

Re: Client table update on dataset update

Post by ViktorV » Thu 11 Apr 2019 11:21

MariaDB server does not provide the ability to retrieve information about changes made in another query without requesting a server.
To quickly get changes made by other queries, you can use the TCustomDADataSet.RefreshQuick method. Note that for this method to work, it is necessary that the table has unique key fields and a TIMESTAMP field. You can get more information about this method in MyDAC help: https://devart.com/mydac/docs/devart.my ... olean).htm

FCS
Posts: 165
Joined: Sat 23 Feb 2013 18:46

Re: Client table update on dataset update

Post by FCS » Thu 11 Apr 2019 13:44

Hello,

Reading this post I have a question:

How works RefreshQuick if there are a few DataTimeStamp fields in the table ?

Regards
Michal

ViktorV
Devart Team
Posts: 2661
Joined: Wed 30 Jul 2014 07:16

Re: Client table update on dataset update

Post by ViktorV » Fri 12 Apr 2019 12:58

For the TUniQuery.RefreshQuick method to work correctly, the timestamp field must be present in the SELECT query. If there are several such fields in the query, the last timestamp field present in the SELECT query will be used.
Note that the timestamp field in the database table should be as follows:

Code: Select all

timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

FCS
Posts: 165
Joined: Sat 23 Feb 2013 18:46

Re: Client table update on dataset update

Post by FCS » Fri 12 Apr 2019 18:08

Hello,

Could you consider to set directly the time stamp field in the next build of UniDac ?

I have tables with several time stamps fields but the field with this requirements is not the last field and there are next time stamp fields after that field.

Sorry Oakley that I interfere your post.

Regards
Michal

ViktorV
Devart Team
Posts: 2661
Joined: Wed 30 Jul 2014 07:16

Re: Client table update on dataset update

Post by ViktorV » Mon 15 Apr 2019 10:42

If you want us to add the specified functionality, please write about it on our User Voice forum: https://devart.uservoice.com/forums/104 ... components. If your suggestion gets enough votes, we will consider the possibility of its creation.
At the moment, to solve the problem, as we have already written, the timestamp of the type CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP must be present last in the SELECT query of all the timestamp fields present in the query.

Post Reply