예제 #1
0
        public override void PreExecute()
        {
            _allRowCount    = 0;
            _limitRowsToLog = (int)ComponentMetaData.CustomPropertyCollection["LimitNumberOfRowsToLog"].Value;
            var input = ComponentMetaData.InputCollection[0];

            _inputColumnInfos = new ColumnInfo[input.InputColumnCollection.Count];
            _auditSchema      = new StringBuilder();

            _cmd = new SqlCommand("ssis.LogAuditRow", _connection)
            {
                CommandType = CommandType.StoredProcedure
            };
            _cmd.Parameters.Add("@ExecutionID", SqlDbType.BigInt);
            _cmd.Parameters.Add("@ComponentName", SqlDbType.NVarChar, 200);
            _cmd.Parameters.Add("@ObjectName", SqlDbType.NVarChar, 200);
            _cmd.Parameters.Add("@AuditType", SqlDbType.VarChar, 30);
            _cmd.Parameters.Add("@RowCount", SqlDbType.Int);
            _cmd.Parameters.Add("@AuditRowSchema", SqlDbType.Xml);

            var param = new SqlParameter("@AuditRowData", SqlDbType.Structured)
            {
                TypeName = "dbo.AuditRowDataType"
            };

            _cmd.Parameters.Add(param);

            var settings = new XmlWriterSettings {
                ConformanceLevel = ConformanceLevel.Fragment
            };

            _auditSchemaXmlWriter = XmlWriter.Create(_auditSchema, settings);
            _auditSchemaXmlWriter.WriteStartElement("schema");
            for (var i = 0; i < input.InputColumnCollection.Count; i++)
            {
                var column = input.InputColumnCollection[i];
                _inputColumnInfos[i] = new ColumnInfo
                {
                    BufferColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID),
                    ColumnDisposition = column.ErrorRowDisposition,
                    LineageID         = column.LineageID,
                    Name      = column.Name,
                    DataType  = column.DataType.ToString(),
                    CodePage  = column.CodePage,
                    Length    = column.Length,
                    Precision = column.Precision,
                    Scale     = column.Scale
                };
                _auditSchemaXmlWriter.WriteStartElement("column");
                _auditSchemaXmlWriter.WriteAttributeString("name", column.Name);
                _auditSchemaXmlWriter.WriteAttributeString("datatype", column.DataType.ToString());
                _auditSchemaXmlWriter.WriteAttributeString("length", column.Length.ToString(CultureInfo.InvariantCulture));
                _auditSchemaXmlWriter.WriteAttributeString("codepage", column.CodePage.ToString(CultureInfo.InvariantCulture));
                _auditSchemaXmlWriter.WriteAttributeString("scale", column.Scale.ToString(CultureInfo.InvariantCulture));
                _auditSchemaXmlWriter.WriteAttributeString("precision", column.Precision.ToString(CultureInfo.InvariantCulture));
                _auditSchemaXmlWriter.WriteEndElement();
            }
            _auditSchemaXmlWriter.WriteEndElement();
            _auditSchemaXmlWriter.Close();
        }
        /// <summary>
        /// Do any initial setup operations
        /// </summary>
        public override void PreExecute()
        {
            base.PreExecute();

            // Get the field names from the input collection
            _bufferLookup = (from col in
                             ComponentMetaData.InputCollection[0].InputColumnCollection.Cast <IDTSInputColumn>()
                             join metaCol in ComponentMetaData.InputCollection[0].ExternalMetadataColumnCollection.Cast <IDTSExternalMetadataColumn>()
                             on col.ExternalMetadataColumnID equals metaCol.ID
                             select new
            {
                Name = (string)metaCol.CustomPropertyCollection["Id"].Value,
                BufferColumn = BufferManager.FindColumnByLineageID(ComponentMetaData.InputCollection[0].Buffer, col.LineageID)
            }).ToDictionary(a => a.Name, a => a.BufferColumn);

            // Get the field data types from the input collection
            _bufferLookupDataType = (from col in
                                     ComponentMetaData.InputCollection[0].InputColumnCollection.Cast <IDTSInputColumn>()
                                     join metaCol in ComponentMetaData.InputCollection[0].ExternalMetadataColumnCollection.Cast <IDTSExternalMetadataColumn>()
                                     on col.ExternalMetadataColumnID equals metaCol.ID
                                     select new
            {
                Name = (string)metaCol.CustomPropertyCollection["Id"].Value,
                DataType = col.DataType
            }).ToDictionary(a => a.Name, a => a.DataType);
        }
        public override void PreExecute()
        {
            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

            m_FileNameColumnIndex = (int)BufferManager.FindColumnByLineageID(output.Buffer, output.OutputColumnCollection[0].LineageID);
            m_FileBlobColumnIndex = (int)BufferManager.FindColumnByLineageID(output.Buffer, output.OutputColumnCollection[1].LineageID);
        }
예제 #4
0
        /// <summary>
        /// Called prior to ProcessInput, the buffer column index, index of the character to change, and the operation
        /// for each column in the input collection is read, and stored.
        /// </summary>
        public override void PreExecute()
        {
            //bool flag = false;
            IDTSInput100 input = base.ComponentMetaData.InputCollection[0];

            inputColumnInfos = new ColumnInfo[input.InputColumnCollection.Count];
            for (var i = 0; i < input.InputColumnCollection.Count; i++)
            {
                IDTSInputColumn100 column = input.InputColumnCollection[i];
                inputColumnInfos[i] = new ColumnInfo
                {
                    bufferColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID),
                    columnDisposition = column.ErrorRowDisposition,
                    lineageID         = column.LineageID,
                    dataType          = column.DataType.ToString()
                };
            }
            IDTSOutput100 output = base.ComponentMetaData.OutputCollection[0];

            outputColumnInfos = new ColumnInfo[output.OutputColumnCollection.Count];
            for (var j = 0; j < output.OutputColumnCollection.Count; j++)
            {
                IDTSOutputColumn100 column2 = output.OutputColumnCollection[j];
                outputColumnInfos[j] = new ColumnInfo
                {
                    bufferColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, column2.LineageID),
                    columnDisposition = column2.ErrorRowDisposition,
                    lineageID         = column2.LineageID,
                    dataType          = column2.DataType.ToString()
                };
            }

            //IDTSCustomProperty100 HashDualSHA1Algorithm = ComponentMetaData.CustomPropertyCollection["HashDual"];
        }
예제 #5
0
        public override void PreExecute()
        {
            IDTSInput100 input = ComponentMetaData.InputCollection[0];

            foreach (IDTSInputColumn100 col in input.InputColumnCollection)
            {
                IDTSExternalMetadataColumn100 ecol = input.ExternalMetadataColumnCollection.GetObjectByID(col.ExternalMetadataColumnID);

                columnInfo ci = new columnInfo();
                ci.bufferColumnIndex     = BufferManager.FindColumnByLineageID(input.Buffer, col.LineageID);
                ci.columnName            = ecol.Name;
                ci.lineageID             = col.LineageID;
                ci.errorDisposition      = col.ErrorRowDisposition;
                ci.truncationDisposition = col.TruncationRowDisposition;
                if (ecol.Name == (string)ComponentMetaData.CustomPropertyCollection["Geometry Column"].Value)
                {
                    ci.geom = true;
                }
                else
                {
                    ci.geom = false;
                }
                this.columnInformation.Add(ci);
            }

            //set batchSize
            this.batchSize = (int)ComponentMetaData.CustomPropertyCollection["Batch Size"].Value;
        }
예제 #6
0
        public override void PreExecute()
        {
            //get default output
            IDTSOutput100 defaultOutput = null;

            this.GetErrorOutputInfo(ref errorOutputID, ref errorOutputIndex);
            foreach (IDTSOutput100 output in ComponentMetaData.OutputCollection)
            {
                if (output.ID != errorOutputID)
                {
                    defaultOutput = output;
                }
            }

            //for each output column add columnInfo object to columnInformation arrayList
            foreach (IDTSOutputColumn100 col in defaultOutput.OutputColumnCollection)
            {
                columnInfo ci = new columnInfo();
                ci.bufferColumnIndex     = BufferManager.FindColumnByLineageID(defaultOutput.Buffer, col.LineageID);
                ci.lineageID             = col.LineageID;
                ci.columnName            = col.Name;
                ci.errorDisposition      = col.ErrorRowDisposition;
                ci.truncationDisposition = col.TruncationRowDisposition;
                if (col.Name == (string)ComponentMetaData.CustomPropertyCollection["Geometry Column"].Value)
                {
                    ci.geom = true;
                }
                else
                {
                    ci.geom = false;
                }
                this.columnInformation.Add(ci);
            }
        }
예제 #7
0
        // In the PreExecute phase we will be caching the column indexes looked up by the LineageID
        public override void PreExecute()
        {
            // Initialize the cache
            columnIndexes = new Dictionary <string, Dictionary <string, int> >();

            // Get the model
            JSONDataModel model = getModel();

            // For each table definition
            foreach (DataTable table in model.Tables)
            {
                // Find the ouput
                IDTSOutput100 output = ComponentMetaData.OutputCollection[table.TableName];

                // ... and initialize the corresponding cache index
                columnIndexes[table.TableName] = new Dictionary <string, int>();

                // For every column
                foreach (IDTSOutputColumn100 col in output.OutputColumnCollection)
                {
                    // We wrap this in a try-catch without exception handling so that
                    // we allow for a subset of the outputs to be used. If an output is not
                    // connected, the columns defined in that output will not be in the Buffer
                    try
                    {
                        // Cache the buffer column index
                        columnIndexes[table.TableName][col.Name] = BufferManager.FindColumnByLineageID(output.Buffer, col.LineageID);
                    }
                    catch
                    {
                        // Do nothing for now
                    }
                }
            }
        }
        /// <summary>
        /// Processes the only supported input.
        /// </summary>
        /// <param name="inputID"></param>
        /// <param name="buffer"></param>
        public override void ProcessInput(int inputID, PipelineBuffer buffer)
        {
            IDTSInput100  input  = ComponentMetaData.InputCollection.GetObjectByID(inputID);
            IDTSOutput100 output = ComponentMetaData.OutputCollection[OUTPUT_NAME];

            IDTSOutputColumn100 rowHashColumn = output.OutputColumnCollection[ROW_HASH_COLUMN_NAME];
            Int32 rowHashColumnIndex          = BufferManager.FindColumnByLineageID(input.Buffer, rowHashColumn.LineageID);

            // Processes each incoming pipeline row.
            while (buffer.NextRow())
            {
                List <Byte[]> columnBytesCollection = new List <Byte[]>();

                // Version 2: In the order of the input columns specified by the Ordinal custom property ...
                foreach (IDTSInputColumn100 inputColumn in _columnCollection.Values)
                {
                    Int32 inputColumnIndex = input.InputColumnCollection.GetObjectIndexByID(inputColumn.ID);

                    // ... retrieves the binary representation of the column value.
                    columnBytesCollection.Add(this.GetColumnValueBytes(buffer, inputColumn, inputColumnIndex));
                }

                // Writes the current row hash value to the built-in output column.
                buffer.SetBytes(rowHashColumnIndex, this.ComputeHash(columnBytesCollection));
            }
        }
예제 #9
0
        public override void PreExecute()
        {
            IDTSInput100 input = ComponentMetaData.InputCollection[0];

            this.inputColumnBufferIndex = BufferManager.FindColumnByLineageID(input.Buffer, input.InputColumnCollection[0].LineageID);

            //Get output id info
            int defaultOutputID  = -1;
            int errorOutputID    = -1;
            int errorOutputIndex = -1;

            GetErrorOutputInfo(ref errorOutputID, ref errorOutputIndex);

            if (errorOutputIndex == 0)
            {
                defaultOutputID = ComponentMetaData.OutputCollection[1].ID;
            }
            else
            {
                defaultOutputID = ComponentMetaData.OutputCollection[0].ID;
            }

            IDTSOutput100 output = ComponentMetaData.OutputCollection.GetObjectByID(defaultOutputID);

            if (output.OutputColumnCollection.Count == 0)
            {
                this.outputColumnBufferIndex = -1;
            }
            else
            {
                this.outputColumnBufferIndex = BufferManager.FindColumnByLineageID(input.Buffer, output.OutputColumnCollection[0].LineageID);
            }
        }
예제 #10
0
        public override void ProcessInput(int inputID, PipelineBuffer buffer)
        {
            var          tableName = ComponentMetaData.CustomPropertyCollection["TableName"].Value;
            IDTSInput100 input     = ComponentMetaData.InputCollection.GetObjectByID(inputID);

            while (buffer.NextRow())
            {
                List <String> sqlStmtAruments = new List <string>();

                foreach (IDTSInputColumn100 col in input.InputColumnCollection)
                {
                    int colIndex = BufferManager.FindColumnByLineageID(input.Buffer, col.LineageID);
                    sqlStmtAruments.Add(buffer[colIndex].ToString());
                }

                String sqlStmt = "insert into " + tableName + " values (" + String.Join(", ", sqlStmtAruments) + ")";

                var Insert = connection.Procedures.Wrap <Null, string>("@AdHoc");

                Insert.Execute(sqlStmt);

                /*
                 *
                 * var genericMethod = typeof(ProcedureAccess).GetMethod("Wrap");
                 * var typedMethod = genericMethod.MakeGenericMethod(
                 *   typeof(Null),
                 *   typeof(Int32),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Int32)
                 *   );
                 *
                 * object[] procNameParam = { "InsertOrder" };
                 *
                 * var Insert = typedMethod.Invoke(connection.Procedures, procNameParam);
                 * //var Insert = connection.Procedures.Wrap<Null, Int32, Double, Double, Double, Double, Double, Int32>("InsertOrder");
                 *
                 * var genericProcMethod = typeof(ProcedureWrapper).GetMethod("Execute");
                 * var typedProcMethod = genericProcMethod.MakeGenericMethod(
                 *   typeof(Null),
                 *   typeof(Int32),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Double),
                 *   typeof(Int32)
                 *   );
                 *
                 * object[] procArgs = { productCode, shippingWeight, shippingLength, shippingWidth, shippingHeight, unitCost, perOrder };
                 * typedProcMethod.Invoke(Insert, procArgs);*/

                //Insert.Execute(productCode, shippingWeight, shippingLength, shippingWidth, shippingHeight, unitCost, perOrder);
            }
        }
예제 #11
0
        public override void PreExecute()
        {
            if (DataTable == null)
            {
                DataTable = new DataTable("SsisUnit");
            }

            if (_bufferColumnMapping == null)
            {
                _bufferColumnMapping = new Dictionary <string, int>();
            }
            else
            {
                _bufferColumnMapping.Clear();
            }

            var names = new Dictionary <string, int>();

            foreach (IDTSInputColumn column in ComponentMetaData.InputCollection[0].InputColumnCollection)
            {
                int value;
                if (names.TryGetValue(column.Name, out value))
                {
                    names[column.Name] = value + 1;
                }
                else
                {
                    names[column.Name] = 1;
                }
            }

            foreach (IDTSInputColumn column in ComponentMetaData.InputCollection[0].InputColumnCollection)
            {
                bool isLong = false;
                _bufferColumnMapping.Add(GetColumName(names, column), BufferManager.FindColumnByLineageID(ComponentMetaData.InputCollection[0].Buffer, column.LineageID));
                var dataColumn = new DataColumn(GetColumName(names, column))
                {
                    DataType  = BufferTypeToDataRecordType(ConvertBufferDataTypeToFitManaged(column.DataType, ref isLong)),
                    MaxLength = column.Length == 0 ? -1 : column.Length
                };
                if (column.CodePage != 0)
                {
                    dataColumn.ExtendedProperties.Add("codePage", column.CodePage);
                }

                if (column.Scale != 0)
                {
                    dataColumn.ExtendedProperties.Add("scale", column.Scale);
                }

                if (column.Precision != 0)
                {
                    dataColumn.ExtendedProperties.Add("precision", column.Precision);
                }

                DataTable.Columns.Add(dataColumn);
            }
        }
예제 #12
0
        protected int GetInputColumnId(string columnName)
        {
            var inputBuffer = ComponentMetaData.InputCollection[0].Buffer;
            var inputColumn = InputColumns.Single(oc => oc.Name == columnName);

            var columnId = BufferManager.FindColumnByLineageID(inputBuffer, inputColumn.LineageID);

            return(columnId);
        }
예제 #13
0
        public override void PreExecute()
        {
            var input = ComponentMetaData.InputCollection[0];
            // ProvideComponentPropertiesで設定した出力列([行番号]カラム)の取得
            var rowCountColumn = ComponentMetaData.OutputCollection[0].OutputColumnCollection[0];

            // BufferManagerから[行番号]カラムがbufferのどこにあるかを特定する
            _rowCountColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, rowCountColumn.LineageID);
        }
예제 #14
0
        /// <summary>
        /// 実行前処理
        /// </summary>
        public override void PreExecute()
        {
            // 変換用辞書を初期化
            _nameDic = new Dictionary <char, char>()
            {
                { 'ぁ', 'あ' },
                { 'ぃ', 'い' },
                { 'ぅ', 'う' },
                { 'ぇ', 'え' },
                { 'ぉ', 'お' },
                { 'っ', 'つ' },
                { 'ゃ', 'や' },
                { 'ゅ', 'ゆ' },
                { 'ょ', 'よ' },
                { 'ゎ', 'わ' },
                { 'ァ', 'ア' },
                { 'ィ', 'イ' },
                { 'ゥ', 'ウ' },
                { 'ェ', 'エ' },
                { 'ォ', 'オ' },
                { 'ヵ', 'カ' },
                { 'ヶ', 'ケ' },
                { 'ッ', 'ツ' },
                { 'ャ', 'ヤ' },
                { 'ュ', 'ユ' },
                { 'ョ', 'ヨ' },
                { 'ヮ', 'ワ' },
            };

            // buffer上の入力列位置情報を取得
            var input = ComponentMetaData.InputCollection[0];

            _inputColumns = input.InputColumnCollection
                            .Cast <IDTSInputColumn100>()
                            .Select(x => new InputColumn
            {
                Name        = x.Name,
                BufferIndex = BufferManager.FindColumnByLineageID(input.Buffer, x.LineageID),
                UsageType   = x.UsageType,
                LineageID   = x.LineageID,
            })
                            .ToList();

            // buffer上の出力列位置情報を取得
            var output = ComponentMetaData.OutputCollection[0];

            _outputColumns = output.OutputColumnCollection
                             .Cast <IDTSOutputColumn100>()
                             .Select(x => new OutputColumn
            {
                Name           = x.Name,
                BufferIndex    = BufferManager.FindColumnByLineageID(input.Buffer, x.LineageID),
                InputLineageID = GetInputLineageID(x)
            })
                             .ToList();
        }
예제 #15
0
        protected int GetInputCollumnIndex(string name)
        {
            var inputCollection = ComponentMetaData.InputCollection[0];
            var inputColumns    = inputCollection.InputColumnCollection.Cast <IDTSInputColumn100>();
            var inputColumn     = inputColumns.Single(c => c.Name == name);

            var index = (int)BufferManager.FindColumnByLineageID(inputCollection.Buffer, inputColumn.LineageID);

            return(index);
        }
예제 #16
0
        protected int GetOutputColumnIndex(string columnName)
        {
            var outputCollection = ComponentMetaData.OutputCollection[0];
            var outputColumns    = outputCollection.OutputColumnCollection.Cast <IDTSOutputColumn100>();
            var outputColumn     = outputColumns.Single(c => c.Name == columnName);

            var index = (int)BufferManager.FindColumnByLineageID(outputCollection.Buffer, outputColumn.LineageID);

            return(index);
        }
예제 #17
0
        private int GetCollumnIndex(string name)
        {
            var output  = ComponentMetaData.OutputCollection[0];
            var columns = output.OutputColumnCollection.Cast <IDTSOutputColumn100>();
            var column  = columns.Single(c => c.Name == name);

            var index = (int)BufferManager.FindColumnByLineageID(output.Buffer, column.LineageID);

            return(index);
        }
예제 #18
0
        /// <summary>
        /// Called before execution. Initialize resources.
        /// </summary>
        public override void PreExecute()
        {
            _ContainerID  = (string)this.GetPropertyValue("ContainerID");
            _idColumnName = (string)this.GetPropertyValue("IDColumn");
            _EntityKind   = (string)this.GetPropertyValue("EntityKind");
            _CreateNewID  = (bool)this.GetPropertyValue("CreateNewID");
            _multithread  = (bool)this.GetPropertyValue("UseMultithreadInsert");

            _Container = _con.GetContainerById(_ContainerID);

            // Cache all of our input column information
            // We do this here because the calls to the native interops
            // degrades performance during the ProcessInput() calls.
            IDTSInput100 input = ComponentMetaData.InputCollection[0];

            Debug.Assert(input != null);

            _inputColumnInfo = new List <InputColumnInfo>(input.InputColumnCollection.Count);
            foreach (IDTSInputColumn100 column in input.InputColumnCollection)
            {
                InputColumnInfo info = new InputColumnInfo();
                info.Name     = column.Name;
                info.DataType = column.DataType;
                info.ID       = column.ID;
                info.Index    = BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID);

                _inputColumnInfo.Add(info);
            }

            // Set the ID Column information
            if (_CreateNewID == false)
            {
                bool foundId = false;
                foreach (InputColumnInfo info in _inputColumnInfo)
                {
                    if (info.Name == _idColumnName)
                    {
                        _idColumnIndex = info.Index;
                        _idColumnId    = info.ID;

                        foundId = true;
                        break;
                    }
                }

                if (!foundId)
                {
                    ComponentMetaData.FireError(0, ComponentMetaData.Name, "Can't find ID Column: " + _idColumnName, string.Empty, 0, out this._cancel);
                    return;
                }
            }

            // Set the Error output ID
            _errorOutputId = ComponentMetaData.OutputCollection[0].ID;
        }
        //=================================================================================================

        #endregion

        //=================================================================================================

        #endregion

        #region Runtime

        /// <summary>
        /// Called before PrimeOutput. Find and store the index in the buffer of each of the columns in the output, and the
        /// name of the column at the external data source.
        /// </summary>
        public override void PreExecute()
        {
            m_columnInfo = new ArrayList();
            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

            foreach (IDTSOutputColumn100 col in output.OutputColumnCollection)
            {
                ColumnInfo ci = new ColumnInfo();
                ci.BufferColumnIndex = BufferManager.FindColumnByLineageID(output.Buffer, col.LineageID);
                ci.ColumnName        = col.Name;
                m_columnInfo.Add(ci);
            }
        }
예제 #20
0
        public override void PreExecute()
        {
            base.PreExecute();

            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

            mapOutputColsToBufferCols = new int[output.OutputColumnCollection.Count];

            for (int i = 0; i < ComponentMetaData.OutputCollection[0].OutputColumnCollection.Count; i++)
            {
                mapOutputColsToBufferCols[i] = BufferManager.FindColumnByLineageID(output.Buffer, output.OutputColumnCollection[i].LineageID);
            }
        }
예제 #21
0
        public override void PreExecute()
        {
            this._relation                = (relationType)ComponentMetaData.CustomPropertyCollection["Spatial Relation"].Value;
            this._targetCache             = new OGRBufferCache();
            this._joinCache               = new OGRBufferCache();
            this._targetColumnInfoMapList = new List <columnInfoMap>();
            this._joinColumnInfoMapList   = new List <columnInfoMap>();
            this._targetID                = ComponentMetaData.InputCollection["Target Input"].ID;
            this._joinID = ComponentMetaData.InputCollection["Join Input"].ID;

            IDTSOutput100 defaultOutput = ComponentMetaData.OutputCollection[0];
            IDTSInput100  targetInput   = ComponentMetaData.InputCollection["Target Input"];

            foreach (IDTSInputColumn100 inputColumn in targetInput.InputColumnCollection)
            {
                if (((string)ComponentMetaData.CustomPropertyCollection["Target Input Geometry Column"].Value).Equals(inputColumn.Name))
                {
                    this._targetGeomIndex = BufferManager.FindColumnByLineageID(targetInput.Buffer, inputColumn.LineageID);
                }
                foreach (IDTSOutputColumn100 outputColumn in defaultOutput.OutputColumnCollection)
                {
                    if (outputColumn.Name.Equals(targetInput.Name + "." + inputColumn.Name))
                    {
                        columnInfoMap ci = new columnInfoMap();
                        ci.inputBufferIndex  = BufferManager.FindColumnByLineageID(targetInput.Buffer, inputColumn.LineageID);
                        ci.outputBufferIndex = BufferManager.FindColumnByLineageID(defaultOutput.Buffer, outputColumn.LineageID);
                        this._targetColumnInfoMapList.Add(ci);
                    }
                }
            }

            IDTSInput100 joinInput = ComponentMetaData.InputCollection["Join Input"];

            foreach (IDTSInputColumn100 inputColumn in joinInput.InputColumnCollection)
            {
                if (((string)ComponentMetaData.CustomPropertyCollection["Join Input Geometry Column"].Value).Equals(inputColumn.Name))
                {
                    this._joinGeomIndex = BufferManager.FindColumnByLineageID(joinInput.Buffer, inputColumn.LineageID);
                }
                foreach (IDTSOutputColumn100 outputColumn in defaultOutput.OutputColumnCollection)
                {
                    if (outputColumn.Name.Equals(joinInput.Name + "." + inputColumn.Name))
                    {
                        columnInfoMap ci = new columnInfoMap();
                        ci.inputBufferIndex  = BufferManager.FindColumnByLineageID(joinInput.Buffer, inputColumn.LineageID);
                        ci.outputBufferIndex = BufferManager.FindColumnByLineageID(defaultOutput.Buffer, outputColumn.LineageID);
                        this._joinColumnInfoMapList.Add(ci);
                    }
                }
            }
        }
예제 #22
0
        //Run Time - Pre Execute identifying the input columns in this component from Buffer Manager
        public override void PreExecute()
        {
            IDTSInput100 input = ComponentMetaData.InputCollection[0];

            inputBufferColumnIndex = new int[input.InputColumnCollection.Count];
            _phneNumberColumnInfo  = new PhonenumberColumnInfo();
            _phneNumberColumnInfo.UsesIsoAsString      = _phoneNumberIsoLinage == default;
            _phneNumberColumnInfo.PhoneNumberIsoString = _phoneNumberIsoCode;

            for (int x = 0; x < input.InputColumnCollection.Count; x++)
            {
                IDTSInputColumn100 column = input.InputColumnCollection[x];
                inputBufferColumnIndex[x] = BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID);

                if (column.LineageID == _phonenumberLinage)
                {
                    _phneNumberColumnInfo.PhoneNumberBufferIndex = x;
                }
                else if (column.LineageID == _phoneNumberIsoLinage)
                {
                    _phneNumberColumnInfo.PhoneNumberIsoBufferIndex = x;
                }
            }

            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

            outputBufferColumnIndex = new int[output.OutputColumnCollection.Count];

            for (int x = 0; x < output.OutputColumnCollection.Count; x++)
            {
                IDTSOutputColumn100 outcol = output.OutputColumnCollection[x];
                var colreference           = _outputColumnList.FirstOrDefault(c => c.ColumnName == outcol.Name);
                if (colreference != null)
                {
                    colreference.ColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, outcol.LineageID);
                }
                //This is the key - synchronous output does not appear in output buffer, but in input buffer
                outputBufferColumnIndex[x] = BufferManager.FindColumnByLineageID(input.Buffer, outcol.LineageID);
            }

            _outputId = output.ID;

            foreach (IDTSOutput100 outputcoll in ComponentMetaData.OutputCollection)
            {
                if (outputcoll.IsErrorOut)
                {
                    _errorOutId = outputcoll.ID;
                    break;
                }
            }
        }
예제 #23
0
        public override void PreExecute()
        {
            this._columnInfo = new List <ColumnInfo>();

            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

            foreach (IDTSOutputColumn100 col in output.OutputColumnCollection)
            {
                ColumnInfo ci = new ColumnInfo();
                ci.BufferColumnIndex = BufferManager.FindColumnByLineageID(output.Buffer, col.LineageID);
                ci.ColumnName        = (string)col.CustomPropertyCollection["EntityPropertyName"].Value;
                this._columnInfo.Add(ci);
            }
        }
예제 #24
0
        public override void PreExecute()
        {
            base.PreExecute();
            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];
            mapOutputColsToBufferCols = new int[output.OutputColumnCollection.Count];

            for (int i = 0; i < ComponentMetaData.OutputCollection[0].OutputColumnCollection.Count; i++)
            {
                // Here, "i" is the column count in the component's outputcolumncollection
                // and the value of mapOutputColsToBufferCols[i] is the index of the corresponding column in the
                // buffer.
                mapOutputColsToBufferCols[i] = BufferManager.FindColumnByLineageID(output.Buffer, output.OutputColumnCollection[i].LineageID);
            }
        }
예제 #25
0
        public override void PreExecute()
        {
            IDTSInput100 input = ComponentMetaData.InputCollection[0];

            // Read input column information to memory
            foreach (IDTSInputColumn100 inCol in input.InputColumnCollection)
            {
                DestinationColumnInfo ci = new DestinationColumnInfo();
                ci.BufferColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, inCol.LineageID);
                ci.ColumnName        = inCol.Name;
                ci.DataType          = inCol.DataType;
                _colInfos.Add(ci);
            }
            _colInfos.Sort();
        }
예제 #26
0
        public override void PreExecute()
        {
            if (_bufferColumnMapping == null)
            {
                _bufferColumnMapping = new Dictionary <string, int>();
            }
            else
            {
                _bufferColumnMapping.Clear();
            }

            foreach (IDTSOutputColumn column in ComponentMetaData.OutputCollection[0].OutputColumnCollection)
            {
                _bufferColumnMapping.Add(column.Name, BufferManager.FindColumnByLineageID(ComponentMetaData.OutputCollection[0].Buffer, column.LineageID));
            }
        }
예제 #27
0
        public override void PreExecute()
        {
            // Prepare array of column information. Processing requires
            // lineageID so we can do this once in advance.
            IDTSInput100 input = ComponentMetaData.InputCollection[0];

            _inputColumnInfos = new ColumnInfo[input.InputColumnCollection.Count];
            for (int x = 0; x < input.InputColumnCollection.Count; x++)
            {
                IDTSInputColumn100 column = input.InputColumnCollection[x];
                _inputColumnInfos[x] = new ColumnInfo();
                _inputColumnInfos[x].bufferColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID);

                _inputColumnInfos[x].columnDisposition = column.ErrorRowDisposition;
                _inputColumnInfos[x].lineageID         = column.LineageID;
            }
        }
예제 #28
0
        public override void PreExecute()
        {
            this.columnInformation = new List <ColumnInfo>();
            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

            var cloudStorageAccount = CloudStorageAccount.Parse((string)this.ComponentMetaData.CustomPropertyCollection["StorageConnectionString"].Value);

            context = new GenericTableContext(cloudStorageAccount.TableEndpoint.AbsoluteUri, cloudStorageAccount.Credentials);

            foreach (IDTSOutputColumn100 col in output.OutputColumnCollection)
            {
                ColumnInfo ci = new ColumnInfo();
                ci.BufferColumnIndex = BufferManager.FindColumnByLineageID(output.Buffer, col.LineageID);
                ci.ColumnName        = col.Name;
                columnInformation.Add(ci);
            }
        }
예제 #29
0
        /// <summary>
        /// PreExecute is where we write the start of the document and
        /// cache metadata.
        /// </summary>
        public override void PreExecute()
        {
            base.PreExecute();

            // Go ahead and write the file and document element
            m_xmlFile = XmlWriter.Create(this.Filename);
            m_xmlFile.WriteStartDocument();
            m_xmlFile.WriteStartElement(DocumentElementName, DocumentElementNamespace);

            // build a new metadata cache.
            m_bufmap = new Dictionary <int, List <XmlColumnInfo> >();

            // Look at each input, and then each column, storing important metadata.
            foreach (IDTSInput100 input in this.ComponentMetaData.InputCollection)
            {
                List <XmlColumnInfo> cols = new List <XmlColumnInfo>();

                // We make two passes through each input, adding the attributes
                // before the elements, so that ProcessInput will write out attributes
                // before elements (which it needs to!)
                foreach (IDTSInputColumn100 col in input.InputColumnCollection)
                {
                    bool isAttribute = (string)col.CustomPropertyCollection[Constants.StyleProperty].Value == Constants.AttributeStyle;
                    if (isAttribute)
                    {
                        // Find the position in buffers that this column will take, and add it to the map.
                        cols.Add(new XmlColumnInfo((string)col.CustomPropertyCollection[Constants.AttributeOrElementNameProperty].Value, col.DataType,
                                                   BufferManager.FindColumnByLineageID(input.Buffer, col.LineageID),
                                                   true));
                    }
                }
                // add all of the attributes, then all of the elements
                foreach (IDTSInputColumn100 col in input.InputColumnCollection)
                {
                    bool isAttribute = (string)col.CustomPropertyCollection[Constants.StyleProperty].Value == Constants.AttributeStyle;
                    if (!isAttribute)
                    {
                        // Find the position in buffers that this column will take, and add it to the map.
                        cols.Add(new XmlColumnInfo((string)col.CustomPropertyCollection[Constants.AttributeOrElementNameProperty].Value, col.DataType,
                                                   BufferManager.FindColumnByLineageID(input.Buffer, col.LineageID),
                                                   false));
                    }
                }
                m_bufmap.Add(input.ID, cols);
            }
        }
예제 #30
0
        public override void PreExecute()
        {
            //Debugger.Launch();

            IDTSInput100 input = ComponentMetaData.InputCollection[0];
            IDTSInputColumnCollection100 inputColumns = input.InputColumnCollection;
            IDTSCustomProperty100        custProp;

            foreach (IDTSInputColumn100 column in inputColumns)
            {
                custProp = column.CustomPropertyCollection["IsFileName"];
                if ((bool)custProp.Value == true)
                {
                    m_FileNameColumnIndex = (int)BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID);
                }
            }
        }