This commit is contained in:
HSunboy 2018-09-03 16:25:47 +08:00
parent 25a3f892f7
commit 8902672269
2 changed files with 20 additions and 12 deletions

View File

@ -4349,10 +4349,12 @@ case 1320:
}; };
if ($$[$0-1]) { if ($$[$0-1]) {
if(this.$.primary){
this.$.primary.alias = $$[$0-1].alias; this.$.primary.alias = $$[$0-1].alias;
parser.addTablePrimary({ subQueryAlias: $$[$0-1].alias }); parser.addTablePrimary({ subQueryAlias: $$[$0-1].alias });
parser.addSubqueryAliasLocation($$[$0-1].location, $$[$0-1].alias, $$[$0-2].identifierChain); parser.addSubqueryAliasLocation($$[$0-1].location, $$[$0-1].alias, $$[$0-2].identifierChain);
} }
}
var keywords = []; var keywords = [];
if ($$[$0] && $$[$0].suggestKeywords) { if ($$[$0] && $$[$0].suggestKeywords) {
@ -4451,10 +4453,12 @@ break;
case 1355: case 1355:
var subQuery = parser.getSubQuery($$[$0]); var subQuery = parser.getSubQuery($$[$0]);
if(subQuery){
subQuery.columns.forEach(function (column) { subQuery.columns.forEach(function (column) {
parser.expandIdentifierChain({ wrapper: column }); parser.expandIdentifierChain({ wrapper: column });
delete column.linked; delete column.linked;
}); });
}
parser.popQueryState(subQuery); parser.popQueryState(subQuery);
this.$ = subQuery; this.$ = subQuery;

View File

@ -2958,10 +2958,12 @@ TablePrimary
}; };
if ($2) { if ($2) {
if($$.primary){
$$.primary.alias = $2.alias; $$.primary.alias = $2.alias;
parser.addTablePrimary({ subQueryAlias: $2.alias }); parser.addTablePrimary({ subQueryAlias: $2.alias });
parser.addSubqueryAliasLocation($2.location, $2.alias, $1.identifierChain); parser.addSubqueryAliasLocation($2.location, $2.alias, $1.identifierChain);
} }
}
var keywords = []; var keywords = [];
if ($3 && $3.suggestKeywords) { if ($3 && $3.suggestKeywords) {
@ -3127,10 +3129,12 @@ TableSubQueryInner
: PushQueryState SubQuery : PushQueryState SubQuery
{ {
var subQuery = parser.getSubQuery($2); var subQuery = parser.getSubQuery($2);
if(subQuery){
subQuery.columns.forEach(function (column) { subQuery.columns.forEach(function (column) {
parser.expandIdentifierChain({ wrapper: column }); parser.expandIdentifierChain({ wrapper: column });
delete column.linked; delete column.linked;
}); });
}
parser.popQueryState(subQuery); parser.popQueryState(subQuery);
$$ = subQuery; $$ = subQuery;
} }