Exemple #1
0
        protected string GetAggregate(AggregateParameter wItem, bool withAlias)
        {
            string query = string.Empty;

            switch (wItem.Function)
            {
            case AggregateParameter.Func.Avg:
                query += "AVG(";
                break;

            case AggregateParameter.Func.Count:
                query += "COUNT(";
                break;

            case AggregateParameter.Func.Max:
                query += "MAX(";
                break;

            case AggregateParameter.Func.Min:
                query += "MIN(";
                break;

            case AggregateParameter.Func.Sum:
                query += "SUM(";
                break;

            case AggregateParameter.Func.StdDev:
                query += "TRUNC(STDDEV(";
                break;

            case AggregateParameter.Func.Var:
                query += "VARIANCE(";
                break;
            }
            if (wItem.Distinct)
            {
                query += "DISTINCT ";
            }
            query += "\"" + wItem.Column + "\")";
            if (wItem.Function == AggregateParameter.Func.StdDev)
            {
                query += ", 10)";
            }
            if (withAlias && wItem.Alias != string.Empty)
            {
                query += " AS \"" + wItem.Alias + "\"";
            }
            return(query);
        }
        protected string GetAggregate(AggregateParameter wItem, bool withAlias)
        {
            string query = string.Empty;

            switch (wItem.Function)
            {
            case AggregateParameter.Func.Avg:
                query += "Avg(";
                break;

            case AggregateParameter.Func.Count:
                query += "Count(";
                break;

            case AggregateParameter.Func.Max:
                query += "Max(";
                break;

            case AggregateParameter.Func.Min:
                query += "Min(";
                break;

            case AggregateParameter.Func.Sum:
                query += "Sum(";
                break;

            case AggregateParameter.Func.StdDev:
                query += "StDev(";
                break;

            case AggregateParameter.Func.Var:
                query += "Var(";
                break;
            }
            if (wItem.Distinct)
            {
                query += "DISTINCT ";
            }
            query += "[" + wItem.Column + "])";
            if (withAlias && wItem.Alias != string.Empty)
            {
                query += " AS [" + wItem.Alias + "]";
            }
            return(query);
        }
 public override void AddGroupBy(AggregateParameter aggregate)
 {
     base.AddGroupBy(GetAggregate(aggregate, false));
 }
 public override void AddOrderBy(AggregateParameter aggregate, DAL.WhereParameter.Dir direction)
 {
     base.AddOrderBy(GetAggregate(aggregate, false), direction);
 }
 public virtual void AddGroupBy(AggregateParameter aggregate)
 {
 }
 public virtual void AddOrderBy(AggregateParameter aggregate, WhereParameter.Dir direction)
 {
 }
Exemple #7
0
 public override void AddGroupBy(AggregateParameter aggregate)
 {
     base.AddGroupBy("`" + aggregate.Alias + "`");
 }
Exemple #8
0
 public override void AddOrderBy(AggregateParameter aggregate, Raf.Dal.WhereParameter.Dir direction)
 {
     base.AddOrderBy("`" + aggregate.Alias + "`", direction);
 }