Shouldn't the SQLConnection's DatetimeReadFormat affect TZFormatSettings...?

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: 796
Joined: 18.11.2018, 17:37
Location: Hungary

Shouldn't the SQLConnection's DatetimeReadFormat affect TZFormatSettings...?

Post by aehimself »

Hello,

I have a connection, where I set the DatetimeReadFormat property to yyyy.mm.dd hh:nn:ss. Displaying the information in a DBGrid works just fine.
However, when I copy the data with ClipBoard.AsText := Self.SelectedField.AsString; this format is omitted and resets to TZFormatSettings and results something like "2018/ 12/ 12/ 0:00:00".

So, the question is, shouldn't DatetimeReadFormat affect the format settings inside a TZConnection...?

If yes, an important note to add is that these properties are NOT set design-time but runtime, before calling .Connect.
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
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Shouldn't the SQLConnection's DatetimeReadFormat affect TZFormatSettings...?

Post by marsupilami »

Hello aehimself,

I am not sure, if I understand you correctly. DatetimeReadFormat is meant for situations where we read dates and time from the database as Strings. So it tells us how the database formats its DateTime values. It shouldn't do anything on TZFormatSettings because they are used for displaying dates and times to the user only - at least as far as I know. This is what the documentation has to day about this:
Zeos 7.2 Release Notes wrote: The ReadFormat parameters decribe the date and time formats as the database sends them to the application.
[...]
These settings can be used to solve problems on the following drivers:
  • dblib (FreeTDS, mssql, sybase)
  • postgresql
  • mysql (depending on parameter preferprepared, used if preferprepared is not set)
  • ado (emulated parameters [...])
We don't use these params on PostgreSQL anymore because there we use binary representations now.

Best regards,

Jan
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 796
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Shouldn't the SQLConnection's DatetimeReadFormat affect TZFormatSettings...?

Post by aehimself »

Ooooooooooh that makes sense.

So the answer is: absolutely NOT :)

Thanks for clearing this up so quickly!
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