TZReadOnlyQuery preserves sorting without preserving sorting...?

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 797
Joined: 18.11.2018, 17:37
Location: Hungary

TZReadOnlyQuery preserves sorting without preserving sorting...?

Post by aehimself »

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:
OrderbyID.PNG
Now, let's manually sort it by LastChanged:
OrderByLastChanged.PNG
Now select a different option, closing and reopening the dataset:
OrderByWhatNow.PNG
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
You do not have the required permissions to view the files attached to this post.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 797
Joined: 18.11.2018, 17:37
Location: Hungary

Re: TZReadOnlyQuery preserves sorting without preserving sorting...?

Post by aehimself »

Please disregard this post. The issue was me, leaving a tiny piece of code somewhere else which manually reset the .SortedFields property.
Zeos is working fine, I just need to sleep more... :(
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Post Reply