fkInternalCalc and RefreshOptions problem
Posted: Tue 03 Mar 2020 08:03
Hello,
I'm trying to upgrade from MyDAC for Delphi/C++ Builder (2006). From 7.6.11 to 10.1.2 (trial currently). Everything seems to work, except fields calculated on MySQL side like: count(*), subqueries fields etc.
Some time ago (migrating from 4.x to 7.x) the sollution was to set fields as fkInternalCalc and ReadOnly, and it worked like a charm.
Now I cannot enter dataset edit mode when - for example - RefreshOptions.roBeforeEdit is set to true. Looking at SQL monitor output, the query passed to DB is a SELECT with all the fields in dataset - event the fkInternalCalc ones.
So for example a simple query, counting positions for all documents:
When roBeforeEdit is set makes a query before edit:
This of course fails as the field "poscount" does NOT exists in database.
It does not matter wheter I set field origins, updating table, key fields, provider flags, hidden, readolny, required etc.
The solution is to append somewhere in the code. However the queries are quite complex, build real-time, and counted in hundreds of controls.
So - the final question. Is this a bug, or is there some kind of compatiblity flag, to regain fkInternalCalc behaviour from version 7.x, without the need of creating SQLRefresh and changing half of the project?
I'm trying to upgrade from MyDAC for Delphi/C++ Builder (2006). From 7.6.11 to 10.1.2 (trial currently). Everything seems to work, except fields calculated on MySQL side like: count(*), subqueries fields etc.
Some time ago (migrating from 4.x to 7.x) the sollution was to set fields as fkInternalCalc and ReadOnly, and it worked like a charm.
Now I cannot enter dataset edit mode when - for example - RefreshOptions.roBeforeEdit is set to true. Looking at SQL monitor output, the query passed to DB is a SELECT with all the fields in dataset - event the fkInternalCalc ones.
So for example a simple query, counting positions for all documents:
Code: Select all
SELECT documents.id, count(*) AS poscount
FROM documents, positions WHERE documents.key=posistions.master_key
GROUP BY documents.id
Code: Select all
SELECT id AS _1, poscount AS _2 FROM documents WHERE id='exampledocument'
It does not matter wheter I set field origins, updating table, key fields, provider flags, hidden, readolny, required etc.
The solution is to append
Code: Select all
WHERE documents.id = :ID
So - the final question. Is this a bug, or is there some kind of compatiblity flag, to regain fkInternalCalc behaviour from version 7.x, without the need of creating SQLRefresh and changing half of the project?