Hello
I have a problem with 6.6.5 stable, Latarus 0.9.29 beta and FPC 2.5.1.
I have some float fields in a Sqlite3 database. Under Zeos I get only 0 values. A TSQLQuery with a TSQLite3Connection returns the right values.
Has anyone an idea what may be wrong?
thx
Float fields return 0
Moderators: gto, EgonHugeist
Hi
I managed to debug ZSysUtils and found whats going wrong. Why this code in :
Why this coding for FPC? The value that SQLite returns has a '.' as decimal separator.
I managed to debug ZSysUtils and found whats going wrong. Why this code in :
Code: Select all
function SQLStrToFloatDef(Str: string; Def: Extended): Extended;
.
.
{$IFDEF FPC}
if OldDecimalSeparator = ',' then
begin
DecimalSeparator := OldDecimalSeparator;
Result := StrToFloatDef(Str, Def);
end
else
Result := StrToFloatDef(Str, Def);
{$ELSE}
Result := StrToFloatDef(Str, Def);
{$ENDIF}
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
I have no clue. I did find it myself some weeks ago and I removed it from the sources now. The simple version is in 6.6-patches branch, so will be included in next stable release.
Mark
Code: Select all
function SQLStrToFloatDef(Str: string; Def: Extended): Extended;
var
OldDecimalSeparator: Char;
begin
OldDecimalSeparator := DecimalSeparator;
DecimalSeparator := '.';
if Pos('$', Str) = 1 then
Str := Copy(Str, 2, Pred(Length(Str)));
If Str = '' then
Result := Def
else
Result := StrToFloatDef(Str, Def);
DecimalSeparator := OldDecimalSeparator;
end;