TimeStamp column type - Migrating from Zeos to MyDAC

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ca_cruiser
Posts: 13
Joined: Tue 17 May 2005 12:59

TimeStamp column type - Migrating from Zeos to MyDAC

Post by ca_cruiser » Wed 27 Dec 2006 19:52

Hello,

I'm swapping out data access components from Zeos to MyDAC. The MySql column type TimeStamp(14) is returned as follows:

Zeos : TStringField
MyDac: TDateTime

How can I get the MyDAC components to treat the MySql TimeStamp column to be returned as a TStringField ?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 28 Dec 2006 13:19

There are two ways to solve this problem. The first way is to set the FieldsAsString option of TMyQuery to True. In this case every field in DataSet will be described as TStringField. The second way is to cast this field on the server to string. For more information about the DATE_FORMAT function see the MySQL Reference Manual.

String value from a TDateTimeField field can be read in this way:

Code: Select all

s := c_timestamp14_field.AsString

ca_cruiser
Posts: 13
Joined: Tue 17 May 2005 12:59

Post by ca_cruiser » Thu 28 Dec 2006 13:51

Sorry, but I should have given more details.

I understand I can handle this programmatically .AsString but my problem is that when using 3rd party components (like RaveReports), it directly reads the Table and Field as TString under Zeos and TDateTime under MyDAC.

Can this only be addressed by acquiring the source code and making modifications?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 29 Dec 2006 08:30

Yes, such behaviour can be achieved only with source code of MyDAC.

Post Reply