How to migrate TDateTimeField to TZDateTimeField?

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
shmorsecode
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 30.11.2023, 18:55

How to migrate TDateTimeField to TZDateTimeField?

Post by shmorsecode »

Hi

I've been tasked with upgrading a large project that used ZeosLib 6.5.1 from Delphi 2007 to Delphi 10.2.
The original authors of the project had a habit of adding persistent fields everywhere, so obviously I ran into type mismatch on every field when opening any TZQuery. I wrote a program to help me with updating the classnames (wish I could just nuke the fields, but I can't, spaghetti is too strong).

Anyways, I'm not sure how to deal with TDateFimeField - specifically it's DisplayFormat and EditMask fields.
I understand that DisplayFormat is now TZDisplayTimestampFormatSettings, and there is now both EditMask and EditFormat, but given this example:

Code: Select all

object QList_time: TDateTimeField
   FieldName = 'time'
   DisplayFormat = 'dd-mm-yyyy hh:mm'
end
object QList_deadline: TDateTimeField
   FieldName = 'deadline'
   EditMask = 'dd-mm-yyyy'
end
Which properties of TZDateTimeField need to be set to what values, in order to preserve the original behavior?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: How to migrate TDateTimeField to TZDateTimeField?

Post by marsupilami »

Hello shmorsecode,

Zeos now allows to use much more detailed settings than were available with Delphi. The DisplayFormat equivalent of TZDateTimeField is DisplayFormat.Format. The following are lines from an application that we develop:

Code: Select all

  (DataSet.FieldByName('VON') as TZTimeField).DisplayFormat.Format := 'hh:nn';
  (DataSet.FieldByName('BIS') as TZTimeField).DisplayFormat.Format := 'hh:nn';
The EditMask of TZDateTimeField still should be EditMask. There should be no changes for the EditMask property.

Best regards,

Jan
Post Reply