Пример #1
0
        internal static Column ToColumn(NonSelectColumnArgument column)
        {
            if (column == null)
            {
                return(null);
            }

            if (column.ArgType == typeof(System.String))
            {
                return(new Column((System.String)column.Original));
            }
            else if (column.ArgType == typeof(Identifier))
            {
                return(new Column((Identifier)column.Original));
            }
            else if (column.ArgType == typeof(OfChainer))
            {
                return(new Column((OfChainer)column.Original));
            }
            else if (column.ArgType == typeof(DbColumn))
            {
                return(new Column((DbColumn)column.Original));
            }

            return(null);
        }
Пример #2
0
 /// <summary>
 /// UNPIVOT performs the opposite operation to PIVOT by rotating columns of a table-valued expression into column values. Note that UNPIVOT is not the exact reverse of PIVOT. PIVOT performs an aggregation and, therefore, merges possible multiple rows into a single row in the output. UNPIVOT does not reproduce the original table-valued expression result because rows have been merged.
 /// </summary>
 /// <param name="prev">A predecessor object.</param>
 /// <param name="valueColumn">Is a column that will hold the rotated values.</param>
 /// <param name="rotatingColumn">Is a rotating column whose values will become the rotated column names in the pivot table.</param>
 /// <param name="firstRotatedColumn">The first rotated column in the pivot table.</param>
 /// <param name="otherRotatedColumns">Other rotated columns in the pivot table.</param>
 public static PivotChainer Unpivot(this IPivot prev,
                                    NonSelectColumnArgument valueColumn,
                                    NonSelectColumnArgument rotatingColumn,
                                    string firstRotatedColumn, params string[] otherRotatedColumns)
 {
     return(new PivotChainer((Chainer)prev, valueColumn, rotatingColumn,
                             Common.MergeArrays <string>(firstRotatedColumn, otherRotatedColumns)));
 }
Пример #3
0
 /// <summary>
 /// Adds a new column in the table declaration block.
 /// </summary>
 /// <param name="prev">A predecessor object.</param>
 /// <param name="column">A column argument.</param>
 /// <typeparam name="T">A type of a column.</typeparam>
 public static BeginTableColumnChainer AddColumn <T>(this IBeginTableColumn prev, NonSelectColumnArgument column)
 {
     return(new BeginTableColumnChainer((Chainer)prev, column, typeof(T)));
 }
Пример #4
0
 /// <summary>
 /// Adds a new column in the table declaration block.
 /// </summary>
 /// <param name="prev">A predecessor object.</param>
 /// <param name="column">A column argument.</param>
 /// <param name="dataTypeDef">A column data type definition.</param>
 public static BeginTableColumnChainer AddColumn(this IBeginTableColumn prev, NonSelectColumnArgument column,
                                                 DataType dataTypeDef)
 {
     return(new BeginTableColumnChainer((Chainer)prev, column, dataTypeDef));
 }
Пример #5
0
 /// <summary>
 /// Specifies the columns to be used in the INSERT statement.
 /// </summary>
 /// <param name="prev">A predecessor object.</param>
 /// <param name="firstColumn">The first column to insert into.</param>
 /// <param name="otherColumns">Other columns to insert into.</param>
 public static ColumnsChainer IntoColumns(this IColumns prev,
                                          NonSelectColumnArgument firstColumn, params NonSelectColumnArgument[] otherColumns)
 {
     return(new ColumnsChainer((Chainer)prev,
                               Common.MergeArrays(firstColumn, otherColumns)));
 }