internal override SqlExpression VisitColumnRef(SqlColumnRef cref) { SqlColumnRef ref2 = this.BubbleUp(cref); if (ref2 == null) { throw Error.ColumnReferencedIsNotInScope(SqlResolver.GetColumnName(cref.Column)); } return(ref2); }
internal override SqlExpression VisitTableValuedFunctionCall(SqlTableValuedFunctionCall fc) { foreach (SqlColumn column in fc.Columns) { if (column == this.match) { if (this.found != null) { throw Error.ColumnIsDefinedInMultiplePlaces(SqlResolver.GetColumnName(this.match)); } this.found = column; return(fc); } } return(fc); }
internal override SqlTable VisitTable(SqlTable tab) { foreach (SqlColumn column in tab.Columns) { if (column == this.match) { if (this.found != null) { throw Error.ColumnIsDefinedInMultiplePlaces(SqlResolver.GetColumnName(this.match)); } this.found = column; return(tab); } } return(tab); }
internal override SqlRow VisitRow(SqlRow row) { foreach (SqlColumn column in row.Columns) { if (RefersToColumn(column, this.match)) { if (this.found != null) { throw Error.ColumnIsDefinedInMultiplePlaces(SqlResolver.GetColumnName(this.match)); } this.found = column; return(row); } } return(row); }
internal override SqlSelect VisitSelect(SqlSelect select) { this.Visit(select.Row); if (this.found == null) { this.Visit(select.From); if (this.found == null) { return(select); } if (select.IsDistinct && !this.match.IsConstantColumn) { throw Error.ColumnIsNotAccessibleThroughDistinct(SqlResolver.GetColumnName(this.match)); } if ((select.GroupBy.Count != 0) && !this.IsFoundInGroup(select)) { throw Error.ColumnIsNotAccessibleThroughGroupBy(SqlResolver.GetColumnName(this.match)); } this.ForceLocal(select.Row, this.found.Name); } return(select); }