Browse Source

fpSQLParser: fix float literal parsing (make it locale-independent)

git-svn-id: trunk@49564 -
ondrej 4 years ago
parent
commit
48f259589b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/fcl-db/src/sql/fpsqlparser.pas

+ 6 - 1
packages/fcl-db/src/sql/fpsqlparser.pas

@@ -2241,6 +2241,9 @@ end;
 
 
 function TSQLParser.CreateLiteral(AParent : TSQLElement) : TSQLLiteral;
 function TSQLParser.CreateLiteral(AParent : TSQLElement) : TSQLLiteral;
 
 
+var
+  SQLFS: TFormatSettings;
+
 begin
 begin
   Result:=Nil;
   Result:=Nil;
   Case CurrentToken of
   Case CurrentToken of
@@ -2257,7 +2260,9 @@ begin
     tsqlFloatNumber:
     tsqlFloatNumber:
       begin
       begin
       Result:=TSQLLiteral(CreateElement(TSQLFloatLiteral,AParent));
       Result:=TSQLLiteral(CreateElement(TSQLFloatLiteral,AParent));
-      TSQLFloatLiteral(Result).Value:=StrToFloat(CurrentTokenString);
+      SQLFS:=DefaultFormatSettings;
+      SQLFS.DecimalSeparator:='.';
+      TSQLFloatLiteral(Result).Value:=StrToFloat(CurrentTokenString,SQLFS);
       end;
       end;
     tsqlNull :
     tsqlNull :
       Result:=TSQLLiteral(CreateElement(TSQLNullLiteral,AParent));
       Result:=TSQLLiteral(CreateElement(TSQLNullLiteral,AParent));