Browse Source

* Fixed bug ID #26137 (script stops on empty statement)

git-svn-id: trunk@27931 -
michael 11 years ago
parent
commit
07626f029a
1 changed files with 6 additions and 16 deletions
  1. 6 16
      packages/fcl-db/src/base/sqlscript.pp

+ 6 - 16
packages/fcl-db/src/base/sqlscript.pp

@@ -280,19 +280,9 @@ end;
 
 
 function TCustomSQLScript.Available: Boolean;
 function TCustomSQLScript.Available: Boolean;
 
 
-var 
-  SCol, 
-  SLine: Integer;
-  
 begin
 begin
-  SCol:=FCol;
-  SLine:=FLine;
-  try
-    Result:=Length(Trim(NextStatement()))>0;
-  Finally  
-    FCol:=SCol;
-    FLine:=SLine;
-  end;  
+  With FSQL do
+    Result:=(FLine<Count) or (FCol<Length(Strings[Count-1]))
 end;
 end;
 
 
 procedure TCustomSQLScript.InternalStatement(Statement: TStrings;  var StopExecution: Boolean);
 procedure TCustomSQLScript.InternalStatement(Statement: TStrings;  var StopExecution: Boolean);
@@ -438,11 +428,11 @@ begin
   FSkipStackIndex:=0;
   FSkipStackIndex:=0;
   Faborted:=False;
   Faborted:=False;
   DefaultDirectives;
   DefaultDirectives;
-  while not FAborted and Available() do
-    begin
+  Repeat
     NextStatement();
     NextStatement();
-    ProcessStatement;
-    end;
+    if Length(Trim(FCurrentStatement.Text))>0 then
+      ProcessStatement;
+  Until FAborted or Not Available;
 end;
 end;
 
 
 function TCustomSQLScript.NextStatement: AnsiString;
 function TCustomSQLScript.NextStatement: AnsiString;