Fix conversion of datetime fields in TDbf
Original Reporter info from Mantis: luizamerico
-
Reporter name: Luiz Americo
Original Reporter info from Mantis: luizamerico
- Reporter name: Luiz Americo
Description:
Currently, when a datetime field is set in TDbf, the value is converted from TDateTime to timestamp at TDataset.SetFieldData.
In TDbf.SetFieldData, the value is treated as a TDateTime and is converted again to timestamp.
One of the problems caused by this bug is an exception at the db test framework (TTestDBExport.TestDBFExport_DBaseVII).
36526.4480555556 is set to TDateTimeField.AsDateTime
36526.4480555556 is converted to 63082406712000 (timestamp) at TDataset.SetFieldData
TDbf.SetFieldData tries to convert 63082406712000 to timestamp -> crash
The attached patch fixes this issue.
Probably (not tested) will affect backward compatibility so a flag may be necessary.
Mantis conversion info:
- Mantis ID: 28734
- Fixed in version: 3.1.1
- Fixed in revision: 33086 (#b38b441d)