Esempio n. 1
0
        /// <summary>
        /// Generates the 'SELECT' part of an <see cref="Aggregate"/>
        /// </summary>
        /// <param name="aggregate">The aggregate to include in the SELECT clause</param>
        /// <returns>
        /// The portion of the SELECT clause represented by this <see cref="Aggregate"/>
        /// </returns>
        /// <remarks>
        /// The ToString() logic moved from <see cref="Aggregate.ToString"/>, rather than
        /// including it in the Aggregate class itself...
        /// </remarks>
        protected override string GenerateAggregateSelect(Aggregate aggregate)
        {
            bool hasAlias = !String.IsNullOrEmpty(aggregate.Alias);

            if(aggregate.AggregateType == AggregateFunction.GroupBy && hasAlias)
                return String.Format("{0} AS \"{1}\"", aggregate.ColumnName, aggregate.Alias);
            if(aggregate.AggregateType == AggregateFunction.GroupBy)
                return aggregate.ColumnName;
            if(hasAlias)
                return String.Format("{0}({1}) AS \"{2}\"", Aggregate.GetFunctionType(aggregate).ToUpper(), aggregate.ColumnName, aggregate.Alias);
            return string.Format("{0}({1})", Aggregate.GetFunctionType(aggregate).ToUpper(), aggregate.ColumnName);
        }
Esempio n. 2
0
 /// <summary>
 /// Groups the by.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="alias">The alias.</param>
 /// <returns></returns>
 public static Aggregate GroupBy(string columnName, string alias)
 {
     Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.GroupBy);
     return agg;
 }
Esempio n. 3
0
 /// <summary>
 /// Groups the by.
 /// </summary>
 /// <param name="tableColumn">The table column.</param>
 /// <param name="alias">The alias.</param>
 /// <returns></returns>
 public static Aggregate GroupBy(TableSchema.TableColumn tableColumn, string alias)
 {
     Aggregate agg = new Aggregate(tableColumn, alias, AggregateFunction.GroupBy);
     return agg;
 }
Esempio n. 4
0
 /// <summary>
 /// Gets the type of the function.
 /// </summary>
 /// <param name="aggregate">The aggregate.</param>
 /// <returns></returns>
 public static string GetFunctionType(Aggregate aggregate)
 {
     return Enum.GetName(typeof(AggregateFunction), aggregate.AggregateType);
 }
Esempio n. 5
0
        /// <summary>
        /// Groups the by.
        /// </summary>
        /// <param name="tableColumn">The table column.</param>
        /// <returns></returns>
        public static Aggregate GroupBy(TableSchema.TableColumn tableColumn)
        {
            Aggregate agg = new Aggregate(tableColumn, AggregateFunction.GroupBy);

            return(agg);
        }
Esempio n. 6
0
 /// <summary>
 /// Variances the specified column name.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="alias">The alias.</param>
 /// <returns></returns>
 public static Aggregate Variance(string columnName, string alias)
 {
     Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.Var);
     return agg;
 }
Esempio n. 7
0
 /// <summary>
 /// Sums the specified column name.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="alias">The alias.</param>
 /// <returns></returns>
 public static Aggregate Sum(string columnName, string alias)
 {
     Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.Sum);
     return agg;
 }
Esempio n. 8
0
 /// <summary>
 /// Standards the deviation.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="alias">The alias.</param>
 /// <returns></returns>
 public static Aggregate StandardDeviation(string columnName, string alias)
 {
     Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.StDev);
     return agg;
 }
Esempio n. 9
0
 /// <summary>
 /// Gets the type of the function.
 /// </summary>
 /// <param name="aggregate">The aggregate.</param>
 /// <returns></returns>
 public static string GetFunctionType(Aggregate aggregate)
 {
     return(Enum.GetName(typeof(AggregateFunction), aggregate.AggregateType));
 }
Esempio n. 10
0
        /// <summary>
        /// Counts the specified col.
        /// </summary>
        /// <param name="tableColumn">The table column.</param>
        /// <param name="alias">The alias.</param>
        /// <returns></returns>
        public static Aggregate Count(TableSchema.TableColumn tableColumn, string alias)
        {
            Aggregate agg = new Aggregate(tableColumn, alias, AggregateFunction.Count);

            return(agg);
        }
Esempio n. 11
0
        /// <summary>
        /// Standards the deviation.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="alias">The alias.</param>
        /// <returns></returns>
        public static Aggregate StandardDeviation(string columnName, string alias)
        {
            Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.StDev);

            return(agg);
        }
Esempio n. 12
0
        /// <summary>
        /// Standards the deviation.
        /// </summary>
        /// <param name="tableColumn">The table column.</param>
        /// <param name="alias">The alias.</param>
        /// <returns></returns>
        public static Aggregate StandardDeviation(TableSchema.TableColumn tableColumn, string alias)
        {
            Aggregate agg = new Aggregate(tableColumn, alias, AggregateFunction.StDev);

            return(agg);
        }
Esempio n. 13
0
        /// <summary>
        /// Variances the specified column name.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="alias">The alias.</param>
        /// <returns></returns>
        public static Aggregate Variance(string columnName, string alias)
        {
            Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.Var);

            return(agg);
        }
Esempio n. 14
0
        /// <summary>
        /// Variances the specified col.
        /// </summary>
        /// <param name="tableColumn">The table column.</param>
        /// <param name="alias">The alias.</param>
        /// <returns></returns>
        public static Aggregate Variance(TableSchema.TableColumn tableColumn, string alias)
        {
            Aggregate agg = new Aggregate(tableColumn, alias, AggregateFunction.Var);

            return(agg);
        }
Esempio n. 15
0
        /// <summary>
        /// Groups the by.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="alias">The alias.</param>
        /// <returns></returns>
        public static Aggregate GroupBy(string columnName, string alias)
        {
            Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.GroupBy);

            return(agg);
        }
Esempio n. 16
0
 /// <summary>
 /// Mins the specified column name.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <returns></returns>
 public static Aggregate Min(string columnName)
 {
     Aggregate agg = new Aggregate(columnName, AggregateFunction.Min);
     return agg;
 }
Esempio n. 17
0
 /// <summary>
 /// Standards the deviation.
 /// </summary>
 /// <param name="tableColumn">The table column.</param>
 /// <param name="alias">The alias.</param>
 /// <returns></returns>
 public static Aggregate StandardDeviation(TableSchema.TableColumn tableColumn, string alias)
 {
     Aggregate agg = new Aggregate(tableColumn, alias, AggregateFunction.StDev);
     return agg;
 }
Esempio n. 18
0
        /// <summary>
        /// Counts the specified column name.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="alias">The alias.</param>
        /// <returns></returns>
        public static Aggregate Count(string columnName, string alias)
        {
            Aggregate agg = new Aggregate(columnName, alias, AggregateFunction.Count);

            return(agg);
        }
Esempio n. 19
0
 /// <summary>
 /// Sums the specified col.
 /// </summary>
 /// <param name="tableColumn">The table column.</param>
 /// <returns></returns>
 public static Aggregate Sum(TableSchema.TableColumn tableColumn)
 {
     Aggregate agg = new Aggregate(tableColumn, AggregateFunction.Sum);
     return agg;
 }
Esempio n. 20
0
        /// <summary>
        /// Sums the specified col.
        /// </summary>
        /// <param name="tableColumn">The table column.</param>
        /// <returns></returns>
        public static Aggregate Sum(TableSchema.TableColumn tableColumn)
        {
            Aggregate agg = new Aggregate(tableColumn, AggregateFunction.Sum);

            return(agg);
        }
Esempio n. 21
0
 /// <summary>
 /// Variances the specified col.
 /// </summary>
 /// <param name="tableColumn">The table column.</param>
 /// <param name="alias">The alias.</param>
 /// <returns></returns>
 public static Aggregate Variance(TableSchema.TableColumn tableColumn, string alias)
 {
     Aggregate agg = new Aggregate(tableColumn, alias, AggregateFunction.Var);
     return agg;
 }
Esempio n. 22
0
        /// <summary>
        /// Sums the specified column name.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <returns></returns>
        public static Aggregate Sum(string columnName)
        {
            Aggregate agg = new Aggregate(columnName, AggregateFunction.Sum);

            return(agg);
        }
Esempio n. 23
0
        /// <summary>
        /// Generates the 'SELECT' part of an <see cref="Aggregate"/>
        /// </summary>
        /// <param name="aggregate">The aggregate to include in the SELECT clause</param>
        /// <returns>The portion of the SELECT clause represented by this <see cref="Aggregate"/></returns>
        /// <remarks>
        /// The ToString() logic moved from <see cref="Aggregate.ToString"/>, rather than
        /// including it in the Aggregate class itself...
        /// </remarks>
        protected virtual string GenerateAggregateSelect(Aggregate aggregate)
        {
            bool hasAlias = !String.IsNullOrEmpty(aggregate.Alias);

            if(aggregate.AggregateType == AggregateFunction.GroupBy && hasAlias)
                return String.Format("{0} AS '{1}'", aggregate.ColumnName, aggregate.Alias);
            if(aggregate.AggregateType == AggregateFunction.GroupBy)
                return aggregate.ColumnName;
            if(hasAlias)
                return String.Format("{0}({1}) AS '{2}'", Aggregate.GetFunctionType(aggregate).ToUpperInvariant(), aggregate.ColumnName, aggregate.Alias);

            return String.Format("{0}({1})", Aggregate.GetFunctionType(aggregate).ToUpperInvariant(), aggregate.ColumnName);
        }
Esempio n. 24
0
 /// <summary>
 /// Counts the specified column name.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <returns></returns>
 public static Aggregate Count(string columnName)
 {
     Aggregate agg = new Aggregate(columnName, AggregateFunction.Count);
     return agg;
 }