mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 07:49:12 +02:00
* Fix bug in SQL -- comment handling (by Andrea Urbani, bug ID #28333)
git-svn-id: trunk@32800 -
This commit is contained in:
parent
46e672e0a0
commit
2b2bf19981
@ -278,7 +278,11 @@ function TCustomSQLScript.Available: Boolean;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
With FSQL do
|
With FSQL do
|
||||||
Result:=(FLine<Count) or (FCol<Length(Strings[Count-1]))
|
Result:=(FLine<Count) or
|
||||||
|
(
|
||||||
|
( FLine = Count ) and
|
||||||
|
( FCol < Length(Strings[Count-1] ) )
|
||||||
|
);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSQLScript.InternalStatement(Statement: TStrings; var StopExecution: Boolean);
|
procedure TCustomSQLScript.InternalStatement(Statement: TStrings; var StopExecution: Boolean);
|
||||||
@ -442,12 +446,11 @@ function TCustomSQLScript.NextStatement: AnsiString;
|
|||||||
|
|
||||||
var
|
var
|
||||||
pnt: AnsiString;
|
pnt: AnsiString;
|
||||||
addnewline,terminator_found: Boolean;
|
terminator_found: Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
terminator_found:=False;
|
terminator_found:=False;
|
||||||
ClearStatement;
|
ClearStatement;
|
||||||
addnewline:=false;
|
|
||||||
while FLine <= FSQL.Count do
|
while FLine <= FSQL.Count do
|
||||||
begin
|
begin
|
||||||
pnt:=FindNextSeparator([FTerminator, '/*', '"', '''', '--']);
|
pnt:=FindNextSeparator([FTerminator, '/*', '"', '''', '--']);
|
||||||
@ -477,12 +480,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
FComment:=True;
|
FComment:=True;
|
||||||
if FCommentsInSQL then
|
if FCommentsInSQL then
|
||||||
begin
|
|
||||||
AddToStatement(Copy(FSQL[FLine-1],FCol,Length(FSQL[FLine-1])-FCol+1),False);
|
AddToStatement(Copy(FSQL[FLine-1],FCol,Length(FSQL[FLine-1])-FCol+1),False);
|
||||||
AddNewLine:=true;
|
|
||||||
end;
|
|
||||||
Inc(Fline);
|
Inc(Fline);
|
||||||
FCol:=0;
|
FCol:=1;
|
||||||
FComment:=False;
|
FComment:=False;
|
||||||
end
|
end
|
||||||
else if pnt = '"' then
|
else if pnt = '"' then
|
||||||
@ -498,8 +498,7 @@ begin
|
|||||||
AddToStatement(pnt,False);
|
AddToStatement(pnt,False);
|
||||||
FCol:=FCol + length(pnt);
|
FCol:=FCol + length(pnt);
|
||||||
pnt:=FindNextSeparator(['''']);
|
pnt:=FindNextSeparator(['''']);
|
||||||
AddToStatement(pnt,addnewline);
|
AddToStatement(pnt,false);
|
||||||
addnewline:=False;
|
|
||||||
FCol:=FCol + length(pnt);
|
FCol:=FCol + length(pnt);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user