0

I have a DataSnap Server with two TFDQuery's via TFDConnectionto a MySQL database. This querys are in a master/detail relationship via a TDataSource (neested datasets). This data is exported via one TDataSetProvider.

In the client side, I have a TDataModule with one TSQLConnection, one TDSProviderConnection and two TClientDataSet's, one for the Master and the other for the Neested Detail via DataSetField property.

When i test my client everything works fine.

The problem is when two clients are working simultaneously over the same detail record, the data I write to one Detail in one Client is not seen from my second Client, and vice versa.

Suppose we have this scenario with a simple bill/items relationship: Bill1, Item1, OriginalData

if i read Bill1 in both clients, both read the same data. If i modify the OriginalData to ModifiedData in my First Client, and execute ApplyUpdates, it works fine, but then i refresh the same Bill1 in my second Client, and still reading the unchanged OriginalData

If I write data into the MasterTable everything works fine, buy with my DetailTable it seems to get data from some cache or something. I reproduce all via BDE components and Paradox database and have no problems, but we need to use FireDac and MySQL

So, here is the question... ¿Why the data written to detail record in the first client is not seen from my second client after calling refresh with DataSnap via FireDacand MySql?

I'm using Delphi Xe5 update 2.

Note: The Master/Detail is a parametrized Query, so only one Bill is active at a time.

Once again, sorry for my poor english.

rlascarez
  • 21
  • 5

1 Answers1

0

Solved it by setting FetchOptions.DetailOptimize=FALSE of the TFDConnection on the server side.

When DetailOptimize is true (default on FireDac) FireDac refresh the detail dataset only when the current detail dataset key field values are different from the master dataset key field values.

For more info read FireDAC.Stan.Option.TFDFetchOptions.DetailOptimize

rlascarez
  • 21
  • 5