/// <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); }
/// <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; }
/// <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; }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <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; }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <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); }
/// <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; }
/// <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); }
/// <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; }
/// <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); }
/// <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); }
/// <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; }