예제 #1
0
        public virtual IDTSInputColumn100 SetInputColumnUsage(object inputPathIndex, object columnIndex, IDTSVirtualInput100 virtualInput, IDTSVirtualInputColumn100 virtualInputColumn, DTSUsageType usageType, bool forceOverwrite)
        {
            if ((virtualInputColumn.UsageType == usageType || virtualInputColumn.UsageType == DTSUsageType.UT_READWRITE) && !forceOverwrite)
            {
            }
            else
            {
                Instance.SetUsageType(Component.InputCollection[inputPathIndex].ID, virtualInput, virtualInputColumn.LineageID, usageType);
            }

            return(TransformationUtility.FindInputColumnByName(columnIndex.ToString(), Component.InputCollection[inputPathIndex], true));
        }
예제 #2
0
        protected override void ProcessBindingMappings(SsisEmitterContext context, MappedBinding mappedBinding, IDTSPath100 path)
        {
            if (mappedBinding != null && path != null)
            {
                foreach (AstDataflowColumnMappingNode map in mappedBinding.Mappings)
                {
                    int lineageId;
                    var matchedOutput = TransformationUtility.FindOutputColumnByName(map.SourceName, path.StartPoint, true);

                    if (matchedOutput == null)
                    {
                        var matchedInput = TransformationUtility.FindVirtualInputColumnByName(map.SourceName, path.EndPoint, true);
                        if (matchedInput == null)
                        {
                            MessageEngine.Trace(_astUnionAllNode, Severity.Error, "V0145", "Could not find input column {0} for transformation {1}", map.SourceName, _astUnionAllNode.Name);
                        }

                        lineageId = matchedInput.LineageID;
                    }
                    else
                    {
                        lineageId = matchedOutput.LineageID;
                    }

                    IDTSInputColumn100 ic = TransformationUtility.FindInputColumnByName(map.SourceName, path.EndPoint, true);
                    if (ic == null)
                    {
                        ic           = path.EndPoint.InputColumnCollection.New();
                        ic.Name      = map.SourceName;
                        ic.LineageID = lineageId;
                    }

                    IDTSOutputColumn100 oc = TransformationUtility.FindOutputColumnByName(map.TargetName, OutputPath, true);
                    if (oc == null)
                    {
                        oc      = OutputPath.OutputColumnCollection.New();
                        oc.Name = map.TargetName;
                        oc.SetDataTypeProperties(ic.DataType, ic.Length, ic.Precision, ic.Scale, ic.CodePage);
                    }

                    IDTSCustomProperty100 cp = TransformationUtility.FindCustomPropertyByName("OutputColumnLineageID", ic.CustomPropertyCollection, true);
                    if (cp == null)
                    {
                        cp      = ic.CustomPropertyCollection.New();
                        cp.Name = "OutputColumnLineageID";
                    }

                    cp.Value = oc.LineageID;
                }
            }
        }
예제 #3
0
        protected virtual void ProcessBindingMappings(SsisEmitterContext context, MappedBinding mappedBinding, IDTSPath100 path)
        {
            if (mappedBinding != null && path != null)
            {
                foreach (AstDataflowColumnMappingNode map in mappedBinding.Mappings)
                {
                    int lineageId;
                    var matchedOutput = TransformationUtility.FindOutputColumnByName(map.SourceName, path.StartPoint, true);

                    if (matchedOutput == null)
                    {
                        var matchedInput = TransformationUtility.FindVirtualInputColumnByName(map.SourceName, path.EndPoint, true);
                        if (matchedInput == null)
                        {
                            // Message.Error
                            throw new InvalidOperationException();
                        }

                        lineageId = matchedInput.LineageID;
                    }
                    else
                    {
                        lineageId = matchedOutput.LineageID;
                    }

                    IDTSInputColumn100 ic = TransformationUtility.FindInputColumnByName(map.SourceName, path.EndPoint, true);
                    if (ic == null)
                    {
                        ic           = path.EndPoint.InputColumnCollection.New();
                        ic.LineageID = lineageId;
                    }

                    if (String.IsNullOrEmpty(map.TargetName))
                    {
                        // TODO: What is the right way to destroy a column in dataflow?
                        ic.UsageType = DTSUsageType.UT_IGNORED;
                    }
                    else
                    {
                        ic.Name = map.TargetName;
                    }
                }
            }
        }
예제 #4
0
        public override void Emit(SsisEmitterContext context)
        {
            ProcessBindings(context);

            // TODO: Add Input column custom property mapping
            foreach (var column in _astSlowlyChangingDimensionNode.Mappings)
            {
                int columnType;
                switch (column.MappingType)
                {
                case ScdColumnMappingType.ChangingAttribute:
                    columnType = 2;
                    break;

                case ScdColumnMappingType.FixedAttribute:
                    columnType = 4;
                    break;

                case ScdColumnMappingType.HistoricalAttribute:
                    columnType = 3;
                    break;

                case ScdColumnMappingType.Key:
                    columnType = 1;
                    break;

                case ScdColumnMappingType.Other:
                    columnType = 0;
                    break;

                default:
                    MessageEngine.Trace(_astSlowlyChangingDimensionNode, Severity.Error, "V0140", "Unrecognized ScdColumnMappingType {0} on column {1}", column.MappingType.ToString(), column.QueryColumnName);
                    return;
                }

                IDTSInputColumn100 inputColumn = TransformationUtility.FindInputColumnByName(column.QueryColumnName, Component.InputCollection[0], true);
                if (inputColumn == null)
                {
                    IDTSVirtualInputColumn100 virtualInputColumn = TransformationUtility.FindVirtualInputColumnByName(column.QueryColumnName, Component.InputCollection[0], true);
                    if (virtualInputColumn == null)
                    {
                        MessageEngine.Trace(_astSlowlyChangingDimensionNode, Severity.Error, "V0141", "Column {0} could not be found", column.QueryColumnName);
                        return;
                    }

                    inputColumn           = Component.InputCollection[0].InputColumnCollection.New();
                    inputColumn.Name      = column.QueryColumnName;
                    inputColumn.LineageID = virtualInputColumn.LineageID;
                }

                IDTSCustomProperty100 propColumnType = TransformationUtility.FindCustomPropertyByName("ColumnType", inputColumn.CustomPropertyCollection, true);
                if (propColumnType == null)
                {
                    propColumnType               = inputColumn.CustomPropertyCollection.New();
                    propColumnType.Name          = "ColumnType";
                    propColumnType.TypeConverter = "ColumnType";
                }

                propColumnType.Value = columnType;
            }
        }