mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-05 01:26:21 +02:00
fcl-db: fix parameter parsing if form "-:param" is used. Do not confuse with simple line comment, which must start with "--". Bug #25505
git-svn-id: trunk@26412 -
This commit is contained in:
parent
d87c503881
commit
336056ba2b
@ -208,9 +208,9 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
repeat // skip until at end of line
|
repeat // skip until at end of line
|
||||||
Inc(p);
|
Inc(p);
|
||||||
until p^ in [#10, #0];
|
until p^ in [#10, #13, #0];
|
||||||
|
while p^ in [#10, #13] do Inc(p); // newline is part of comment
|
||||||
end;
|
end;
|
||||||
if p^<>#0 then Inc(p); // newline is part of comment
|
|
||||||
end;
|
end;
|
||||||
'/': // possible start of /* */ comment
|
'/': // possible start of /* */ comment
|
||||||
begin
|
begin
|
||||||
|
@ -117,6 +117,14 @@ begin
|
|||||||
AssertEquals( StringReplace(SQLStr, ':par', '$', [rfReplaceAll]),
|
AssertEquals( StringReplace(SQLStr, ':par', '$', [rfReplaceAll]),
|
||||||
Params.ParseSQL(SQLStr, True, True, True, psPostgreSQL) );
|
Params.ParseSQL(SQLStr, True, True, True, psPostgreSQL) );
|
||||||
|
|
||||||
|
// Test comments:
|
||||||
|
// Simple comment
|
||||||
|
AssertEquals( 'select * from table where id= --comment :c'#10'$1-$2 or id= --:c'#13'-$3',
|
||||||
|
Params.ParseSQL('select * from table where id= --comment :c'#10':a-:b or id= --:c'#13'-:d', True, True, True, psPostgreSQL));
|
||||||
|
// 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));
|
||||||
|
|
||||||
Params.Free;
|
Params.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user