Page 1 of 1

Client table update on dataset update

Posted: Thu 11 Apr 2019 09:24
by oakley
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

Re: Client table update on dataset update

Posted: Thu 11 Apr 2019 11:21
by ViktorV
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

Re: Client table update on dataset update

Posted: Thu 11 Apr 2019 13:44
by FCS
Hello,

Reading this post I have a question:

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

Regards
Michal

Re: Client table update on dataset update

Posted: Fri 12 Apr 2019 12:58
by ViktorV
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

Re: Client table update on dataset update

Posted: Fri 12 Apr 2019 18:08
by FCS
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

Re: Client table update on dataset update

Posted: Mon 15 Apr 2019 10:42
by ViktorV
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.