public override QsiTableNode VisitFromItem(FromItem item) { if (item.getAlias()?.getAliasColumns()?.size() > 0) { throw new QsiException(QsiError.Syntax); } return(base.VisitFromItem(item)); }
private Column findColumnInAliasedTable(Column column, FromItem fromItem, String aliasPart, String columnPart) { if (column != null) { // ensure that if the column has already been found, return it return(column); } Table table = fromItem.getTable(); if (table != null) { String alias = fromItem.getAlias(); if (alias != null && alias.Equals(aliasPart)) { column = table.getColumnByName(columnPart); } } else { FromItem leftSide = fromItem.getLeftSide(); column = findColumnInAliasedTable(column, leftSide, aliasPart, columnPart); FromItem rightSide = fromItem.getRightSide(); column = findColumnInAliasedTable(column, rightSide, aliasPart, columnPart); if (column != null) { Query subQuery = fromItem.getSubQuery(); if (subQuery != null) { List <FromItem> items = subQuery.getFromClause().getItems(); foreach (FromItem subQueryFromItem in items) { column = findColumnInAliasedTable(column, subQueryFromItem, aliasPart, columnPart); } } } } return(column); }