ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/IBUtils.pas
(Generate patch)

Comparing:
ibx/trunk/fbintf/IBUtils.pas (file contents), Revision 354 by tony, Sat Oct 23 14:32:11 2021 UTC vs.
ibx/branches/journaling/fbintf/IBUtils.pas (file contents), Revision 362 by tony, Tue Dec 7 13:27:39 2021 UTC

# Line 558 | Line 558 | type
558      function TokenFound(var token: TSQLTokens): boolean; virtual;
559      function InternalGetNextToken: TSQLTokens; virtual;
560      procedure Reset; virtual;
561 +    function ReadCharacters(NumOfChars: integer): AnsiString;
562  
563      {Token stack}
564      procedure QueueToken(token: TSQLTokens; text:AnsiString); overload;
# Line 1451 | Line 1452 | begin
1452    ResetQueue;
1453   end;
1454  
1455 + function TSQLTokeniser.ReadCharacters(NumOfChars: integer): AnsiString;
1456 + var i: integer;
1457 + begin
1458 +  Result := FLastChar;
1459 +  for i := 2 to NumOfChars do
1460 +  begin
1461 +    if GetNext = sqltEOF then break;
1462 +    Result := Result + FLastChar;
1463 +  end;
1464 + end;
1465 +
1466   function TSQLTokeniser.GetNextToken: TSQLTokens;
1467   begin
1468    if FQueueState = tsRelease then
# Line 1864 | Line 1876 | begin
1876    {$IFEND}
1877    {$IFEND}
1878    begin
1867    {ThousandSeparator not allowed as by Delphi specs}
1868    if (ThousandSeparator <> DecimalSeparator) and
1869       (Pos(ThousandSeparator, S) <> 0) then
1870        Exit;
1871
1879      for i := length(S) downto 1 do
1880      begin
1881        if S[i] = AnsiChar(DecimalSeparator) then
1882        begin
1883            if ds <> 0 then Exit; {only one allowed}
1884 <          ds := i-1;
1884 >          ds := i;
1885            dec(exponent);
1886            system.Delete(S,i,1);
1887        end
# Line 1893 | Line 1900 | begin
1900        end
1901        else
1902        if not (S[i] in ['0'..'9']) then
1903 +      {Note: ThousandSeparator not allowed by Delphi specs}
1904            Exit; {bad character}
1905      end;
1906  
# Line 1902 | Line 1910 | begin
1910        if Result then
1911        begin
1912          {adjust scale for decimal point}
1913 <        if ds > 0 then
1914 <          Scale := Scale - (exponent - ds - 1);
1913 >        if ds <> 0 then
1914 >          Scale := Scale - (exponent - ds);
1915          Result := TryStrToInt64(system.copy(S,1,exponent-1),Value);
1916        end;
1917      end
1918      else
1919      begin
1920        if ds <> 0 then
1921 <        scale := ds - Length(S);
1921 >        scale := ds - Length(S) - 1;
1922        Result := TryStrToInt64(S,Value);
1923      end;
1924    end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines