static void SetTop(QueryExpression query, int limit) { if (query == null) { throw new ArgumentNullException("query"); } if (limit <= 0) { throw new ArgumentOutOfRangeException("limit"); } if (query.LimitFormat != ' ') { limit = Math.Min(query.RowLimit, limit); } query.SetLimit('L', limit); }
public INode Clone() { QueryExpression queryExpression = new QueryExpression(); queryExpression.Distinct = m_distinct; queryExpression.All = m_all; queryExpression.SetLimit(m_limitFormat, m_limit); if (m_selectItems != null) { queryExpression.SelectItems = (AliasedItem)(m_selectItems.Clone()); } if (m_from != null) { queryExpression.From = (AliasedItem)(m_from.Clone()); } if (m_where != null) { queryExpression.Where = (IExpression)(m_where.Clone()); } if (m_groupBy != null) { queryExpression.GroupBy = (GroupByClause)(m_groupBy.Clone()); } if (m_orderBy != null) { queryExpression.OrderBy = (OrderExpression)(m_orderBy.Clone()); } if (m_next != null) { queryExpression.Add((QueryExpression)(m_next.Clone())); } return(queryExpression); }