mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 06:59:33 +01:00 
			
		
		
		
	* Patch from Dmitry Boyarintsev to support empty statements
git-svn-id: trunk@17545 -
This commit is contained in:
		
							parent
							
								
									a7b281b132
								
							
						
					
					
						commit
						cbcece1ae6
					
				@ -3758,6 +3758,10 @@ end;
 | 
			
		||||
 | 
			
		||||
function TSQLParser.Parse: TSQLElement;
 | 
			
		||||
begin
 | 
			
		||||
  if CurrentToken=tsqlEOF then begin
 | 
			
		||||
    Result:=nil;
 | 
			
		||||
    Exit;
 | 
			
		||||
  end;
 | 
			
		||||
  GetNextToken;
 | 
			
		||||
  Case CurrentToken of
 | 
			
		||||
    tsqlSelect : Result:=ParseSelectStatement(Nil,[]);
 | 
			
		||||
@ -3775,6 +3779,7 @@ begin
 | 
			
		||||
    tsqlDeclare : Result:=ParseDeclareStatement(Nil);
 | 
			
		||||
    tsqlGrant : Result:=ParseGrantStatement(Nil);
 | 
			
		||||
    tsqlRevoke : Result:=ParseRevokeStatement(Nil);
 | 
			
		||||
    tsqlEOF : Result:=nil;
 | 
			
		||||
  else
 | 
			
		||||
    UnexpectedToken;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
@ -831,10 +831,25 @@ type
 | 
			
		||||
    procedure Test2RolesToUser;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
  { TTestGlobalParser }
 | 
			
		||||
 | 
			
		||||
  TTestGlobalParser = Class(TTestSQLParser)
 | 
			
		||||
  published
 | 
			
		||||
    procedure TestEmpty;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
implementation
 | 
			
		||||
 | 
			
		||||
uses typinfo;
 | 
			
		||||
 | 
			
		||||
{ TTestGlobalParser }
 | 
			
		||||
 | 
			
		||||
procedure TTestGlobalParser.TestEmpty;
 | 
			
		||||
begin
 | 
			
		||||
  CreateParser('');
 | 
			
		||||
  AssertNull('Empty statement returns nil',Parser.Parse);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
{ --------------------------------------------------------------------
 | 
			
		||||
  TTestParser
 | 
			
		||||
  --------------------------------------------------------------------}
 | 
			
		||||
@ -7991,6 +8006,7 @@ initialization
 | 
			
		||||
                 TTestCreateTriggerParser,
 | 
			
		||||
                 TTestDeclareExternalFunctionParser,
 | 
			
		||||
                 TTestGrantParser,
 | 
			
		||||
                 TTestRevokeParser]);
 | 
			
		||||
                 TTestRevokeParser,
 | 
			
		||||
                 TTestGlobalParser]);
 | 
			
		||||
end.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user