Skip to content

Commit b4fe825

Browse files
committed
fix: data grid filter cut with several double-dash comments on one line
Refs #2461
1 parent ea9c4d0 commit b4fe825

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

source/apphelpers.pas

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3553,13 +3553,11 @@ class function TSQLBatch.GetSQLWithoutComments(FullSQL: String): String;
35533553
Result := '';
35543554
InLineComment := False;
35553555
InMultiLineComment := False;
3556-
Prev1 := #0;
3557-
Prev2 := #0;
35583556
for i:=1 to Length(FullSQL) do begin
35593557
Cur := FullSQL[i];
35603558
AddCur := True;
3561-
if i > 1 then Prev1 := FullSQL[i-1];
3562-
if i > 2 then Prev2 := FullSQL[i-2];
3559+
if i > 1 then Prev1 := FullSQL[i-1] else Prev1 := #0;
3560+
if i > 2 then Prev2 := FullSQL[i-2] else Prev2 := #0;
35633561

35643562
if (Cur = '*') and (Prev1 = '/') then begin
35653563
InMultiLineComment := True;
@@ -3578,7 +3576,7 @@ class function TSQLBatch.GetSQLWithoutComments(FullSQL: String): String;
35783576
else if Cur = '#' then begin
35793577
InLineComment := True;
35803578
end
3581-
else if (Cur = ' ') and (Prev1 = '-') and (Prev2 = '-') then begin
3579+
else if (not InLineComment) and (Cur = ' ') and (Prev1 = '-') and (Prev2 = '-') then begin
35823580
InLineComment := True;
35833581
System.Delete(Result, Length(Result)-1, 2); // Delete comment chars
35843582
end;

0 commit comments

Comments
 (0)