예제 #1
0
        protected internal override Expression VisitAggregate(AggregateExpression aggregate)
        {
            Expression source = MakeSqlValue(Visit(aggregate.Expression));

            if (source != aggregate.Expression)
            {
                return(new AggregateExpression(aggregate.Type, source, aggregate.AggregateFunction, aggregate.Distinct));
            }
            return(aggregate);
        }
예제 #2
0
        protected internal virtual Expression VisitAggregate(AggregateExpression aggregate)
        {
            Expression source = Visit(aggregate.Expression);

            if (source != aggregate.Expression)
            {
                return(new AggregateExpression(aggregate.Type, source, aggregate.AggregateFunction, aggregate.Distinct));
            }
            return(aggregate);
        }
예제 #3
0
        protected internal virtual Expression VisitAggregate(AggregateExpression aggregate)
        {
            var expressions = Visit(aggregate.Arguments);

            if (expressions != aggregate.Arguments)
            {
                return(new AggregateExpression(aggregate.Type, aggregate.AggregateFunction, expressions));
            }
            return(aggregate);
        }
예제 #4
0
        protected internal override Expression VisitAggregate(AggregateExpression aggregate)
        {
            var saveInAggregate = this.inAggregate;

            this.inAggregate = true;

            var result = base.VisitAggregate(aggregate);

            this.inAggregate = saveInAggregate;

            return(result);
        }
예제 #5
0
        protected internal override Expression VisitAggregate(AggregateExpression aggregate)
        {
            sb.Append(dic[aggregate.AggregateFunction]);
            sb.Append("(");
            if (aggregate.Expression == null)
            {
                sb.Append("*");
            }
            else
            {
                Visit(aggregate.Expression);
            }
            sb.Append(")");

            return(aggregate);
        }
예제 #6
0
        private bool IsCountSumOrAvg(SelectExpression select)
        {
            ColumnDeclaration col = select.Columns.Only();

            if (col == null)
            {
                return(false);
            }

            Expression exp = col.Expression;

            if (exp is IsNullExpression)
            {
                exp = ((IsNullExpression)exp).Expression;
            }

            if (exp.NodeType == ExpressionType.Coalesce)
            {
                var be = ((BinaryExpression)exp);
                if (be.Right.NodeType == ExpressionType.Constant || be.Right is SqlConstantExpression)
                {
                    exp = ((BinaryExpression)exp).Left;
                }
            }

            AggregateExpression aggExp = exp as AggregateExpression;

            if (aggExp == null)
            {
                return(false);
            }

            return(aggExp.AggregateFunction == AggregateSqlFunction.Count ||
                   aggExp.AggregateFunction == AggregateSqlFunction.Sum ||
                   aggExp.AggregateFunction == AggregateSqlFunction.Average ||
                   aggExp.AggregateFunction == AggregateSqlFunction.StdDev ||
                   aggExp.AggregateFunction == AggregateSqlFunction.StdDevP);
        }
예제 #7
0
 public AggregateRequestsExpression(Alias groupByAlias, AggregateExpression aggregate)
     : base(DbExpressionType.AggregateRequest, aggregate.Type)
 {
     this.Aggregate    = aggregate;
     this.GroupByAlias = groupByAlias;
 }
예제 #8
0
 protected virtual bool CompareAggregate(AggregateExpression a, AggregateExpression b)
 {
     return(a.AggregateFunction == b.AggregateFunction && CompareList(a.Arguments, b.Arguments, Compare));
 }
 protected internal override Expression VisitAggregate(AggregateExpression aggregate)
 {
     this.hasAggregate = true;
     return(aggregate);
 }
예제 #10
0
 protected internal override Expression VisitAggregate(AggregateExpression aggregate)
 {
     hasAggregates = true;
     return(base.VisitAggregate(aggregate));
 }
예제 #11
0
 protected virtual bool CompareAggregate(AggregateExpression a, AggregateExpression b)
 {
     return(a.AggregateFunction == b.AggregateFunction && Compare(a.Expression, b.Expression));
 }