private static bool ProcessTake( SqlSelect sqlSelect, TakeResultOperator takeResultOperator) { sqlSelect.AddLimit(takeResultOperator.GetConstantCount()); return(false); }
private static bool ProcessTake( SelectExpression selectExpression, TakeResultOperator takeResultOperator) { selectExpression.AddLimit(takeResultOperator.GetConstantCount()); return(false); }
/// <summary> /// Visits the result operator. /// </summary> /// <param name="resultOperator">Result operator.</param> /// <param name="queryModel">Query model.</param> /// <param name="index">Index.</param> public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index) { if (resultOperator is SkipResultOperator) { SkipResultOperator @operator = resultOperator as SkipResultOperator; this.commandBuilder.LimitParts.From = @operator.GetConstantCount(); } else if (resultOperator is TakeResultOperator) { TakeResultOperator @operator = resultOperator as TakeResultOperator; this.commandBuilder.LimitParts.Count = @operator.GetConstantCount(); } else if (resultOperator is CountResultOperator || resultOperator is LongCountResultOperator) { this.commandBuilder.IsCount = true; } else if (resultOperator is FirstResultOperator || resultOperator is SingleResultOperator) { } else if (resultOperator is DistinctResultOperator) { this.commandBuilder.IsDistinct = true; } else { if (resultOperator is AverageResultOperator) { throw new NotSupportedException(); } if (resultOperator is MaxResultOperator) { throw new NotSupportedException(); } if (resultOperator is MinResultOperator) { throw new NotSupportedException(); } if (resultOperator is SumResultOperator) { throw new NotSupportedException(); } if (resultOperator is ContainsResultOperator) { throw new NotSupportedException(); } if (resultOperator is DefaultIfEmptyResultOperator) { throw new NotSupportedException(); } if (resultOperator is ExceptResultOperator) { throw new NotSupportedException(); } if (resultOperator is GroupResultOperator) { throw new NotSupportedException(); } if (resultOperator is IntersectResultOperator) { throw new NotSupportedException(); } if (resultOperator is OfTypeResultOperator) { throw new NotSupportedException(); } if (resultOperator is UnionResultOperator) { throw new NotSupportedException(); } } }
public void GetConstantCount_NoConstantExpression() { var resultOperator = new TakeResultOperator(new QuerySourceReferenceExpression(ExpressionHelper.CreateMainFromClause_Int())); resultOperator.GetConstantCount(); }
public void GetConstantCount() { Assert.That(_resultOperator.GetConstantCount(), Is.EqualTo(2)); }
public void GetConstantCount_NoConstantExpression () { var resultOperator = new TakeResultOperator (new QuerySourceReferenceExpression (ExpressionHelper.CreateMainFromClause_Int ())); resultOperator.GetConstantCount (); }
private void ProcessTakeOperator(TakeResultOperator resultOperator) { _additionalCriteria.Add(q => q.SetMaxResults(resultOperator.GetConstantCount())); }