From 566a6d289f2f655c33bfd7faeac6f69f15f95eb1 Mon Sep 17 00:00:00 2001 From: michael <michael@freepascal.org> Date: Fri, 29 Jun 2018 09:25:13 +0000 Subject: [PATCH] * Fix negative values, reverted to strtoint git-svn-id: trunk@39339 - --- packages/fcl-db/src/sqldb/mysql/mysqlconn.inc | 50 +++++++------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/packages/fcl-db/src/sqldb/mysql/mysqlconn.inc b/packages/fcl-db/src/sqldb/mysql/mysqlconn.inc index 05c30ec4fd..76e9eead2d 100644 --- a/packages/fcl-db/src/sqldb/mysql/mysqlconn.inc +++ b/packages/fcl-db/src/sqldb/mysql/mysqlconn.inc @@ -897,45 +897,29 @@ begin end; function InternalStrToInt(C: pchar; Len: integer): integer; - procedure r; - begin - raise EConvertError.CreateFmt('"%s" is not a valid digit', [C^]); - end; -var - I: Integer; + +Var + S : String; + begin Result := 0; - for I := 1 to Len do - begin - case C^ of - '0'..'9': Result := Result*10 + Ord(C^)-Ord('0'); - #0: break; - else - r; - end; - Inc(C); - end; + if (Len=0) or (C=Nil) then + exit; + SetString(S,C,Len); + Result:=StrToInt(S); end; -function InternalStrToInt64(C: pchar; Len: integer): LargeInt; - procedure r; - begin - raise EConvertError.CreateFmt('"%s" is not a valid digit', [C^]); - end; -var - I: Integer; +function InternalStrToInt64(C: pchar; Len: integer): Int64; + +Var + S : String; + begin Result := 0; - for I := 1 to Len do - begin - case C^ of - '0'..'9': Result := Result*10 + Ord(C^)-Ord('0'); - #0: break; - else - r; - end; - Inc(C); - end; + if (Len=0) or (C=Nil) then + exit; + SetString(S,C,Len); + Result:=StrToInt64(S); end; function InternalStrToFloat(C: pchar; Len: integer; const Format: TFormatSettings): Extended;