* Implemented AS for table aliases

git-svn-id: trunk@19631 -
This commit is contained in:
michael 2011-11-12 13:05:15 +00:00
parent 7effdb1eaa
commit 672d7f6b63
2 changed files with 16 additions and 1 deletions

View File

@ -323,8 +323,13 @@ begin
T.Params:=ParseValueList(AParent,[eoParamValue]);
GetNextToken;
end;
if (CurrentToken=tsqlIdentifier) then
if (CurrentToken in [tsqlIdentifier,tsqlAs]) then
begin
if CurrentToken=tsqlAs then
begin
GetNextToken;
Expect(tsqlIdentifier);
end;
T.AliasName:=CreateIdentifier(T,CurrentTokenString);
GetNextToken;
end;

View File

@ -377,6 +377,7 @@ type
procedure TestSelectAsteriskOneTable;
procedure TestSelectDistinctAsteriskOneTable;
procedure TestSelectOneFieldOneTableAlias;
procedure TestSelectOneFieldOneTableAsAlias;
procedure TestSelectTwoFieldsTwoTables;
procedure TestSelectTwoFieldsTwoTablesJoin;
procedure TestSelectTwoFieldsTwoInnerTablesJoin;
@ -3680,6 +3681,15 @@ begin
AssertTable(Select.Tables[0],'A');
end;
procedure TTestSelectParser.TestSelectOneFieldOneTableAsAlias;
begin
TestSelect('SELECT C.B FROM A AS C');
AssertEquals('One field',1,Select.Fields.Count);
AssertField(Select.Fields[0],'C.B');
AssertEquals('One table',1,Select.Tables.Count);
AssertTable(Select.Tables[0],'A');
end;
procedure TTestSelectParser.TestSelectTwoFieldsTwoTables;
begin
TestSelect('SELECT B,C FROM A,D');