SQL Server float to Real field conversion bug

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Tokha
Posts: 2
Joined: Wed 06 Nov 2013 04:17

SQL Server float to Real field conversion bug

Post by Tokha » Wed 06 Nov 2013 04:47

Hello!

Delphi XE2
UniDAC 5.1.4
Table on MS SQL Server 2005 Express with two fields of REAL type wich stores float values from Delphi TDateTime type.

After upgrade UniDAC version our old project has been fixed with adding Data Type Mapping to Float in UniQuery designer.

Now when Insert values of Delphi TDateTime type (in mean of Date part) into these REAL fields we have not expected results:
Delphi TDateTime: 41584.7093669676 (is right)
Query parameter value from DBMonitor: -3.68934881474191E19 (is wrong)
Actual field value after insert: -3.68934881474191E19 (is wrong)
This behaviour presents for both FieldByName(...).AsFloat and FieldByName.Value assigns.

AsSingle not works (writes 0 instead any actual values).

With old version of UniDAC (is not recognized what actual was) all was clear and works.

What happend with actual float value before it passed to query parameter? How to fix this behaviour?

Tokha
Posts: 2
Joined: Wed 06 Nov 2013 04:17

Re: SQL Server float to Real field conversion bug

Post by Tokha » Thu 07 Nov 2013 01:41

Problem was solved when all field definitions TFloatField in dfm & pas was changed to TSingleField and Data Type Mapping was removed.

But I guess it's not quite right way.

AndreyZ

Re: SQL Server float to Real field conversion bug

Post by AndreyZ » Thu 07 Nov 2013 13:09

Thank you for the information. We have fixed this problem. This fix will be included in the next UniDAC build.

Post Reply