Example #1
0
        private static string GetAggregateName(SqlAggregateType aggregateType)
        {
            switch (aggregateType)
            {
            case SqlAggregateType.Count:
                return("COUNT");

            case SqlAggregateType.LongCount:
                return("COUNT");

            case SqlAggregateType.Min:
                return("MIN");

            case SqlAggregateType.Max:
                return("MAX");

            case SqlAggregateType.Sum:
                return("SUM");

            case SqlAggregateType.Average:
                return("AVG");

            default:
                throw new NotSupportedException($"Unknown aggregate type: {aggregateType}");
            }
        }
Example #2
0
 public SqlAggregateExpression(Type type, SqlAggregateType aggType, Expression argument, bool isDistinct)
     : base(type)
 {
     this.AggregateType = aggType;
     this.Argument = argument;
     this.IsDistinct = isDistinct;
 }
 public SqlAggregateExpression(Type type, SqlAggregateType aggType, Expression argument, bool isDistinct)
     : base(type)
 {
     this.AggregateType = aggType;
     this.Argument      = argument;
     this.IsDistinct    = isDistinct;
 }
Example #4
0
 public PrivateExecuteResult(IEnumerable <T> results, SelectFirstType selectFirstType, SqlAggregateType sqlAggregateType, bool defaultIfEmpty, Expression defaultValueExpression)
     : this()
 {
     this.results                = results;
     this.sqlAggregateType       = sqlAggregateType;
     this.selectFirstType        = selectFirstType;
     this.defaultIfEmpty         = defaultIfEmpty;
     this.defaultValueExpression = defaultValueExpression;
 }
Example #5
0
        protected static SqlAggregateExpression UpdateAggregate(SqlAggregateExpression sqlAggregate, Type type, SqlAggregateType aggType, Expression arg, bool isDistinct)
        {
            if (type != sqlAggregate.Type || aggType != sqlAggregate.AggregateType || arg != sqlAggregate.Argument || isDistinct != sqlAggregate.IsDistinct)
            {
                return new SqlAggregateExpression(type, aggType, arg, isDistinct);
            }

            return sqlAggregate;
        }
Example #6
0
            public virtual string GetAggregateOperator(SqlAggregateType aggr)
            {
                switch (aggr)
                {
                case SqlAggregateType.Avg:
                    return("AVG");

                case SqlAggregateType.Count:
                    return("COUNT");

                case SqlAggregateType.Max:
                    return("MAX");

                case SqlAggregateType.Min:
                    return("MIN");

                case SqlAggregateType.StdDev:
                    return("STDDEV");

                case SqlAggregateType.Sum:
                    return("SUM");
                }
                return(String.Empty);
            }
 public virtual string GetAggregateOperator(SqlAggregateType aggr)
 {
     switch (aggr)
     {
         case SqlAggregateType.Avg:
             return "AVG";
         case SqlAggregateType.Count:
             return "COUNT";
         case SqlAggregateType.Max:
             return "MAX";
         case SqlAggregateType.Min:
             return "MIN";
         case SqlAggregateType.StdDev:
             return "STDDEV";
         case SqlAggregateType.Sum:
             return "SUM";
     }
     return String.Empty;
 }
Example #8
0
 protected virtual bool RequiresAsteriskWhenNoArgument(SqlAggregateType aggregateType)
 {
     return(aggregateType == SqlAggregateType.Count || aggregateType == SqlAggregateType.LongCount);
 }
        protected static SqlAggregateExpression UpdateAggregate(SqlAggregateExpression sqlAggregate, Type type, SqlAggregateType aggType, Expression arg, bool isDistinct)
        {
            if (type != sqlAggregate.Type || aggType != sqlAggregate.AggregateType || arg != sqlAggregate.Argument || isDistinct != sqlAggregate.IsDistinct)
            {
                return(new SqlAggregateExpression(type, aggType, arg, isDistinct));
            }

            return(sqlAggregate);
        }
Example #10
0
 protected virtual bool RequiresAsteriskWhenNoArgument(SqlAggregateType aggregateType)
 {
     return aggregateType == SqlAggregateType.Count || aggregateType == SqlAggregateType.LongCount;
 }
Example #11
0
 private static string GetAggregateName(SqlAggregateType aggregateType)
 {
     switch (aggregateType)
     {
         case SqlAggregateType.Count:
             return "COUNT";
         case SqlAggregateType.LongCount:
             return "COUNT";
         case SqlAggregateType.Min:
             return "MIN";
         case SqlAggregateType.Max:
             return "MAX";
         case SqlAggregateType.Sum:
             return "SUM";
         case SqlAggregateType.Average:
             return "AVG";
         default:
             throw new NotSupportedException($"Unknown aggregate type: {aggregateType}");
     }
 }
Example #12
0
 public static AggregateSqlExpression Aggregate(SqlAggregateType type, params SqlExpression[] parameters)
 {
     return(new AggregateSqlExpression(type, parameters));
 }
 public AggregateSqlExpression(SqlAggregateType type, params SqlExpression[] parameters)
 {
     Type       = type;
     Parameters = parameters;
 }