[patch_done] Patch for DecimalSeparator on Lazarus/FPC
Posted: 12.09.2009, 17:05
Hi All,
Thanks a lot for Zeos... It's a great library... Recently I change from Delphi do Lazarus/FPC... so, I decide to use Zeos as replacement for ClientDataSet... I use Zeus with FireBird and now, SQLite...
In Brazil, we use comma ',' as Decimal Separator... I note a conversion problem, when Zeos read REAL/FLOAT Field types on SQLite (on FireBird works fine)... all Float fields returns Zero values... (If I change S.O. DecimalSeparator for Dot '.' everething works fine)
After dig, on Zeos Code, I found a correction for the problem...
On function ZSysUtils.SQLStrToFloatDef, there is a especific code to DecimalSeparator as comma ','... But I don't know way... STR parameter came with dot (even when DecimalSeparator is ','), maybe FPC, is doing some translation
So I changed a line in code, to verify If STR parameter realy use a diferente DecimalSeparator than Dot..
Thanks a lot for Zeos... It's a great library... Recently I change from Delphi do Lazarus/FPC... so, I decide to use Zeos as replacement for ClientDataSet... I use Zeus with FireBird and now, SQLite...
In Brazil, we use comma ',' as Decimal Separator... I note a conversion problem, when Zeos read REAL/FLOAT Field types on SQLite (on FireBird works fine)... all Float fields returns Zero values... (If I change S.O. DecimalSeparator for Dot '.' everething works fine)
After dig, on Zeos Code, I found a correction for the problem...
On function ZSysUtils.SQLStrToFloatDef, there is a especific code to DecimalSeparator as comma ','... But I don't know way... STR parameter came with dot (even when DecimalSeparator is ','), maybe FPC, is doing some translation
So I changed a line in code, to verify If STR parameter realy use a diferente DecimalSeparator than Dot..
Code: Select all
Index: core/ZSysUtils.pas
===================================================================
--- core/ZSysUtils.pas (revision 684)
+++ core/ZSysUtils.pas (working copy)
@@ -511,7 +511,7 @@
else
begin
{$IFDEF FPC}
- if OldDecimalSeparator = ',' then
+ if pos(OldDecimalSeparator,Str) > 0 then
begin
DecimalSeparator := OldDecimalSeparator;
Result := StrToFloatDef(Str, Def);