} // constructor /** * Creates a SelectItem that references another select item in a subquery * * @param subQuerySelectItem * @param subQueryFromItem * the FromItem that holds the sub-query */ public SelectItem(SelectItem subQuerySelectItem, FromItem subQueryFromItem) : this(null, subQueryFromItem, null, null, null, subQuerySelectItem, null, false) { if (subQueryFromItem.getSubQuery() == null) { throw new ArgumentException("Only sub-query based FromItems allowed."); } if (subQuerySelectItem.getQuery() != null && !subQuerySelectItem.getQuery().Equals(subQueryFromItem.getSubQuery())) { throw new ArgumentException("The SelectItem must exist in the sub-query"); } } // constructor
public FilterItem setQuery(Query query) { _query = query; if (_childItems == null) { if (_expression == null) { if (_selectItem.getQuery() == null) { _selectItem.setQuery(_query); } if (_operand is SelectItem) { SelectItem operand = (SelectItem)_operand; if (operand.getQuery() == null) { operand.setQuery(_query); } } } } else { foreach (FilterItem item in _childItems) { if (item.getQuery() == null) { item.setQuery(_query); } } } return(this); }
} // groupBy() public Query groupBy(params GroupByItem[] items) { foreach (GroupByItem item in items) { SelectItem selectItem = item.getSelectItem(); if (selectItem != null && selectItem.getQuery() == null) { selectItem.setQuery(this); } } _groupByClause.addItems(items); return(this); } // groupBy()