Page 1 of 1

Mapping TIMESTAMP fields as ftDateTime

Posted: Tue 14 Jul 2009 09:04
by nandod
Hello.
Is there a way to get TIMESTAMP fields mapped as ftDateTime instead of ftSQLTimeStamp? It is crucial for some backward compatibility issues I am having.

Thanks
--
Nando

Posted: Wed 15 Jul 2009 08:49
by Plash
Our driver does not have such feature.

Posted: Wed 15 Jul 2009 08:52
by nandod
I am stuck; what could I do instead? Would you say it's feasible if I implement it myself in the driver (got the source)?
Would you say that writing a specialized TField could work?
Other ideas?

Thanks
--
Nando

Posted: Thu 16 Jul 2009 11:09
by Plash
Starting with Delphi 2007, dbExpress does not support TDateTimeField at all. Maybe you should replace TDateTimeField with TSQLTimeStampField in your code using a program with the Replace in Files feature (like Visual Studio).

I think you can change the field type mapping in the driver source.

Posted: Thu 16 Jul 2009 11:21
by nandod
Thanks, I did it by overriding InternalInitFieldDefs, GetFieldClass and GetFieldData, and creating a custom field type. I convert timestamps on the fly and treat them as datetimes. Works fine, even in D2007.
Can't change the application code - it should remain compatible with the BDE.