示例#1
0
        /// <summary>
        /// <para>GROUPING_ID built-in function.</para>
        /// <para>Is a function that computes the level of grouping.</para>
        /// </summary>
        /// <param name="columns">Are columns in a GROUP BY clause.</param>
        public static SysFn GroupingId(params GroupingArgument[] columns)
        {
            var exception = columns.IsGroupingNull("Sys.GroupingId");

            return(new SysFn((buildContext, buildArgs) =>
            {
                return String.Format(
                    "GROUPING_ID({0})",
                    GroupingArgument.Concatenate(columns, buildContext, buildArgs, false));
            },
                             exception));
        }
示例#2
0
        /// <summary>
        /// <para>CUBE built-in function.</para>
        /// <para>Generates a result set that shows aggregates for all combinations of values in the selected columns.</para>
        /// </summary>
        /// <param name="columns">Are selected columns in a CUBE function.</param>
        public static SysFn Cube(params GroupingArgument[] columns)
        {
            // check null
            var exception = columns.IsGroupingNull("Sys.Cube");

            return(new SysFn((buildContext, buildArgs) =>
            {
                return String.Format(
                    "CUBE({0})",
                    GroupingArgument.Concatenate(columns, buildContext, buildArgs, false));
            },
                             exception));
        }
示例#3
0
 /// <summary>
 /// Divides the result set produced by the FROM clause into partitions to which the ranking function is applied. Columns specifies the columns by which the result set is partitioned. If PARTITION BY is not specified, the function treats all rows of the query result set as a single group.
 /// </summary>
 /// <param name="prev">A predecessor object.</param>
 /// <param name="firstColumn">The first column to partition by.</param>
 /// <param name="otherColumns">Other columns to partition by.</param>
 /// <returns></returns>
 public static RankingPartitionByChainer PartitionBy(this IRankingPartitionBy prev,
                                                     GroupingArgument firstColumn, params GroupingArgument[] otherColumns)
 {
     return(new RankingPartitionByChainer((Chainer)prev,
                                          Common.MergeArrays <GroupingArgument>(firstColumn, otherColumns ?? new GroupingArgument[] { null })));
 }