I changed a big project from old Zeos trunk version to current 8.0 patches branch. I use 64bit FPC 3.2.0 Lazarus Trunk on Windows 7 and communicate with PostgreSQL 10.
On a table I have a value NUMERIC. With this field I got a rangecheck error.
I debugged the issue and can see for a value 0,014 there this tBCD is set:
Code: Select all
FillChar(BCD{%H-}, SizeOf(BCD), 0);
BCD.Fraction[0] := 20;
BCD.Precision := 2;
BCD.SignSpecialPlaces := 3;
If I use BCD := StrToBCD('0,014'), I can see this tBCD is set:
Code: Select all
FillChar(BCD{%H-}, SizeOf(BCD), 0);
BCD.Fraction[0] := 1;
BCD.Fraction[1] := 64;
BCD.Precision := 3;
BCD.SignSpecialPlaces := 3;
If I use BCD := StrToBCD('0,14'), I can see this tBCD is set:
Code: Select all
FillChar(BCD{%H-}, SizeOf(BCD), 0);
BCD.Fraction[0] := 20;
BCD.Precision := 2;
BCD.SignSpecialPlaces := 2;
Now I don't know, if this is a bug in TZAbstractRODataset(DataSet).FResultSet.GetBigDecimal with a wrong comma position or is this BCD value valid and there is a bug in fpc FormatBCD or do I miss something?!
Simple test also a workaround patch added, so I can use Zeos for now.