コード例 #1
0
        public static IDTSOutputColumn100 AddKeyOutputColumns(IDTSOutput100 keyRecords)
        {
            IDTSOutputColumnCollection100 outputColumnCollection = keyRecords.OutputColumnCollection;
            IDTSOutputColumn100           outputColumn           = outputColumnCollection.NewAt(0);

            outputColumn.Name = MessageStrings.KeyRecordKeyColumnName;
            outputColumn.SetDataTypeProperties(DataType.DT_GUID, 0, 0, 0, 0);
            outputColumn.Description = MessageStrings.KeyRecordKeyColumnDescription;
            ManageProperties.AddOutputColumnProperties(outputColumn.CustomPropertyCollection);
            ManageProperties.SetPropertyValue(outputColumn.CustomPropertyCollection, ManageProperties.usageOfColumn, Utilities.usageOfColumnEnum.Key);
            ManageProperties.SetPropertyValue(outputColumn.CustomPropertyCollection, ManageProperties.keyOutputColumnID, -2);

            return(outputColumn);
        }
コード例 #2
0
        public static IDTSOutputColumn100 AddKeyOutputColumns(IDTSOutput100 keyRecords, IDTSOutput100 errorOutput)
        {
            IDTSOutputColumn100 outputColumn = AddKeyOutputColumns(keyRecords);

            IDTSOutputColumn100 errorOutputColumn = errorOutput.OutputColumnCollection.New();

            errorOutputColumn.Name = MessageStrings.KeyRecordKeyColumnName;
            errorOutputColumn.SetDataTypeProperties(DataType.DT_GUID, 0, 0, 0, 0);
            errorOutputColumn.Description = MessageStrings.KeyRecordKeyColumnDescription;
            ManageProperties.AddOutputColumnProperties(errorOutputColumn.CustomPropertyCollection);
            ManageProperties.SetPropertyValue(errorOutputColumn.CustomPropertyCollection, ManageProperties.usageOfColumn, Utilities.usageOfColumnEnum.Key);
            ManageProperties.SetPropertyValue(errorOutputColumn.CustomPropertyCollection, ManageProperties.keyOutputColumnID, outputColumn.ID);

            return(outputColumn);
        }
コード例 #3
0
        /// <summary>
        /// Add the columns required to the Error Output.
        /// </summary>
        /// <param name="errorOutput">The actual error output</param>
        public static void AddErrorOutputColumns(IDTSOutput100 errorOutput)
        {
            IDTSOutputColumnCollection100 outputColumnCollection = errorOutput.OutputColumnCollection;
            IDTSOutputColumn100           outputColumn           = outputColumnCollection.New();

            outputColumn.Name = MessageStrings.ErrorMessageColumnName;
            outputColumn.SetDataTypeProperties(DataType.DT_WSTR, 4000, 0, 0, 0);
            ManageProperties.AddIgnorableColumnProperties(outputColumn.CustomPropertyCollection);
            outputColumn      = outputColumnCollection.New();
            outputColumn.Name = MessageStrings.ColumnDataColumnName;
            outputColumn.SetDataTypeProperties(DataType.DT_WSTR, 4000, 0, 0, 0);
            ManageProperties.AddIgnorableColumnProperties(outputColumn.CustomPropertyCollection);
            outputColumn      = outputColumnCollection.New();
            outputColumn.Name = MessageStrings.RowDataColumnName;
            outputColumn.SetDataTypeProperties(DataType.DT_WSTR, 4000, 0, 0, 0);
            ManageProperties.AddIgnorableColumnProperties(outputColumn.CustomPropertyCollection);
        }
コード例 #4
0
        /// <summary>
        /// Adds the columns that are required to the Number Of Rows output
        /// </summary>
        /// <param name="numberOfRows">the number of rows output</param>
        public static void AddNumberOfRowsOutputColumns(IDTSOutput100 numberOfRows)
        {
            IDTSOutputColumnCollection100 outputColumnCollection = numberOfRows.OutputColumnCollection;
            IDTSOutputColumn100           outputColumn           = outputColumnCollection.New();

            outputColumn.Name = MessageStrings.KeyValueColumnName;
            outputColumn.SetDataTypeProperties(DataType.DT_STR, DefaultStringColumnSize, 0, 0, 1252);
            outputColumn.Description = MessageStrings.KeyValueColumnDescription;
            ManageProperties.AddIgnorableColumnProperties(outputColumn.CustomPropertyCollection);
            outputColumn      = outputColumnCollection.New();
            outputColumn.Name = MessageStrings.NumberOfRowsColumnName;
            outputColumn.SetDataTypeProperties(DataType.DT_I8, 0, 0, 0, 0);
            outputColumn.Description = MessageStrings.NumberOfRowsColumnDescription;
            ManageProperties.AddIgnorableColumnProperties(outputColumn.CustomPropertyCollection);
            outputColumn      = outputColumnCollection.New();
            outputColumn.Name = MessageStrings.KeyValueStatusColumnName;
            outputColumn.SetDataTypeProperties(DataType.DT_STR, DefaultStringColumnSize, 0, 0, 1252);
            outputColumn.Description = MessageStrings.KeyValueStatusColumnDescription;
            ManageProperties.AddIgnorableColumnProperties(outputColumn.CustomPropertyCollection);
        }
コード例 #5
0
ファイル: Utilities.cs プロジェクト: keif888/TextFileSplitter
        public static String DynamicClassStringFromOutput(SSISOutput output, Boolean firstRowColumnNames, String rowTerminator, String columnDelimiter)
        {
            String classString = string.Empty;

            classString += "[DelimitedRecord(\"" + ReplaceEscapes(columnDelimiter) + "\")]\r\n";
            if (firstRowColumnNames)
            {
                classString += "[IgnoreFirst(1)]\r\n";
            }
            classString += "public sealed class " + output.Name + "\r\n";
            classString += "{\r\n";
            for (int i = 0; i < output.OutputColumnCollection.Count; i++)
            {
                SSISOutputColumn outputColumn = output.OutputColumnCollection[i];
                if (!outputColumn.IsDerived)
                {
                    String  conversionString = (String)ManageProperties.GetPropertyValue(outputColumn.CustomPropertyCollection, ManageProperties.dotNetFormatString);
                    Boolean isOptional       = (Boolean)ManageProperties.GetPropertyValue(outputColumn.CustomPropertyCollection, ManageProperties.isColumnOptional);
                    if ((i + 1 == output.OutputColumnCollection.Count) && (!String.IsNullOrEmpty(rowTerminator)))
                    {
                        classString += "[FieldDelimiterAttribute(\"" + ReplaceEscapes(rowTerminator) + "\")]\r\n";
                    }
                    if (isOptional)
                    {
                        classString += "[FieldOptional()]\r\n";
                    }
                    if ((Boolean)ManageProperties.GetPropertyValue(outputColumn.CustomPropertyCollection, ManageProperties.nullResultOnConversionError))
                    {
                        classString += "[FieldNullOnError()]\r\n";
                    }
                    switch (outputColumn.SSISDataType)
                    {
                    case DataType.DT_BOOL:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Boolean, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Boolean? ";
                        break;

                    case DataType.DT_DATE:
                    case DataType.DT_DBDATE:
                    case DataType.DT_DBTIME:
                    case DataType.DT_DBTIME2:
                    case DataType.DT_DBTIMESTAMP:
                    case DataType.DT_DBTIMESTAMP2:
                    case DataType.DT_DBTIMESTAMPOFFSET:
                    case DataType.DT_FILETIME:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Date, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public DateTime? ";
                        break;

                    case DataType.DT_CY:
                    case DataType.DT_DECIMAL:
                    case DataType.DT_NUMERIC:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Decimal, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Decimal? ";
                        break;

                    case DataType.DT_I1:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Byte, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Byte? ";
                        break;

                    case DataType.DT_I2:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Int16, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Int16? ";
                        break;

                    case DataType.DT_I4:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Int32, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Int32? ";
                        break;

                    case DataType.DT_I8:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Int64, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Int64? ";
                        break;

                    case DataType.DT_R4:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Single, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Single? ";
                        break;

                    case DataType.DT_R8:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Dpuble, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Double? ";
                        break;

                    case DataType.DT_UI1:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.SByte, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public SByte? ";
                        break;

                    case DataType.DT_UI2:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.UInt16, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public UInt16? ";
                        break;

                    case DataType.DT_UI4:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.UInt32, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public UInt32? ";
                        break;

                    case DataType.DT_UI8:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.UInt64, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public UInt64? ";
                        break;

                    case DataType.DT_GUID:
                        if (!String.IsNullOrEmpty(conversionString))
                        {
                            classString += "[FieldConverter(ConverterKind.Guid, \"" + conversionString + "\")]\r\n";
                        }
                        classString += "public Guid? ";
                        break;

                    case DataType.DT_STR:
                    case DataType.DT_TEXT:
                    case DataType.DT_NTEXT:
                    case DataType.DT_WSTR:
                        classString += "public String ";
                        break;

                    default:
                        classString += "public String ";
                        break;
                    }
                    classString += outputColumn.Name + ";\r\n";
                }
            }
            classString += "}\r\n";
            return(classString);
        }