fcl-db: sqldb: when parsing SQL end of /* comment */ is not detected if ends with **/. Bug #30171

git-svn-id: trunk@33761 -
This commit is contained in:
lacak 2016-05-23 07:25:21 +00:00
parent 57f93ed40d
commit 33d48897d7
2 changed files with 9 additions and 4 deletions

View File

@ -257,14 +257,17 @@ begin
if p^='*' then // /* */ comment
begin
Result := True;
repeat
Inc(p);
Inc(p);
while p^ <> #0 do
begin
if p^='*' then // possible end of comment
begin
Inc(p);
if p^='/' then Break; // end of comment
end;
until p^=#0;
end
else
Inc(p);
end;
if p^='/' then Inc(p); // skip final /
end;
end;

View File

@ -145,6 +145,8 @@ begin
// Bracketed comment
AssertEquals( 'select * from table where id=/*comment :c*/$1-$2',
Params.ParseSQL('select * from table where id=/*comment :c*/:a-:b', True, True, True, psPostgreSQL));
AssertEquals( 'select * from table where id=/*comment :c**/$1-$2',
Params.ParseSQL('select * from table where id=/*comment :c**/:a-:b', True, True, True, psPostgreSQL));
// Consecutive comments, with quote in second comment
AssertEquals( '--c1'#10'--c'''#10'select '':a'' from table where id=$1',
Params.ParseSQL('--c1'#10'--c'''#10'select '':a'' from table where id=:id', True, True, True, psPostgreSQL));