TZReadOnlyQuery preserves sorting without preserving sorting...?
Posted: 02.06.2022, 10:39
Am I the crazy here or something fancy is going on :)
I have a TZReadOnly query, with the following SQL:
SELECT [...] FROM MyTable WHERE SomeField = :pID ORDER BY ID ASC
When the user changes to a different option, the query is closed, parameter value is updated and is being reopened.
All is connected to a DBGrid.
The strange thing happens when there is sorting enabled, take a look at the screenshots:
Initial state, can be seen it's ordered by ID nicely: Now, let's manually sort it by LastChanged: Now select a different option, closing and reopening the dataset: The gird is not incorrect, DataSet.SortedFields is indeed empty, it should be sorted based on the SQL query (by ID).
So the sorting was somehow preserved internally, but externally it appears to be unsorted...?
Am I going nuts here, or I just messed something up badly? Can someone confirm this, please? :D
I have a TZReadOnly query, with the following SQL:
SELECT [...] FROM MyTable WHERE SomeField = :pID ORDER BY ID ASC
When the user changes to a different option, the query is closed, parameter value is updated and is being reopened.
All is connected to a DBGrid.
The strange thing happens when there is sorting enabled, take a look at the screenshots:
Initial state, can be seen it's ordered by ID nicely: Now, let's manually sort it by LastChanged: Now select a different option, closing and reopening the dataset: The gird is not incorrect, DataSet.SortedFields is indeed empty, it should be sorted based on the SQL query (by ID).
So the sorting was somehow preserved internally, but externally it appears to be unsorted...?
Am I going nuts here, or I just messed something up badly? Can someone confirm this, please? :D