Пример #1
0
        private void EmitReplaceExisting(AstDerivedColumnNode dc)
        {
            IDTSInputColumn100  col        = SetInputColumnUsage(0, dc.Name, DTSUsageType.UT_READWRITE, true);
            IDTSVirtualInput100 vi         = Component.InputCollection[0].GetVirtualInput();
            Expression          expression = ExpressionHandler.ExpressionCleanerAndInputMapBuilder(dc.Expression, this, vi, DTSUsageType.UT_READONLY);

            col.CustomPropertyCollection["Expression"].Value         = expression.ProcessedExpression;
            col.CustomPropertyCollection["FriendlyExpression"].Value = expression.FriendlyExpression;
        }
Пример #2
0
        private void AppendOutputPath(string name, string expression)
        {
            IDTSOutput100 newPath = Component.OutputCollection.New();

            newPath.Name = name;
            ////newPath.Description = name; // No need to set description to same value as name

            newPath.ExclusionGroup             = Component.OutputCollection[0].ExclusionGroup;
            newPath.SynchronousInputID         = Component.OutputCollection[0].SynchronousInputID;
            newPath.ErrorOrTruncationOperation = "Computation";
            newPath.ErrorRowDisposition        = DTSRowDisposition.RD_IgnoreFailure;
            newPath.TruncationRowDisposition   = DTSRowDisposition.RD_FailComponent;

            IDTSCustomProperty100 propExpression = newPath.CustomPropertyCollection.New();

            propExpression.Name = "Expression";
            IDTSVirtualInput100 vi = Component.InputCollection[0].GetVirtualInput();
            ////propExpression.Value = ExpressionHandler.ExpressionCleanerAndInputMapBuilder(expression, this, vi, DTSUsageType.UT_READONLY);
            Expression exp = ExpressionHandler.ExpressionCleanerAndInputMapBuilder(expression.Trim(), this, vi, DTSUsageType.UT_READONLY);

            propExpression.Value      = exp.ProcessedExpression;
            propExpression.ContainsID = exp.ContainsId;
            ////propExpression = ExpressionHandler.ExpressionCleanerAndInputMapBuilder(propExpression, this, vi, DTSUsageType.UT_READONLY);

            IDTSCustomProperty100 propFriendlyExpression = newPath.CustomPropertyCollection.New();

            propFriendlyExpression.Name           = "FriendlyExpression";
            propFriendlyExpression.Value          = exp.FriendlyExpression;
            propFriendlyExpression.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
            propFriendlyExpression.ContainsID     = exp.ContainsId;

            IDTSCustomProperty100 propEvaluationOrder = newPath.CustomPropertyCollection.New();

            propEvaluationOrder.Name  = "EvaluationOrder";
            propEvaluationOrder.Value = _evaluationOrder;

            Component.OutputCollection.SetIndex(Component.OutputCollection.GetObjectIndexByID(newPath.ID), _evaluationOrder);
            _evaluationOrder++;
        }
Пример #3
0
        private void EmitAddNewColumn(AstDerivedColumnNode column)
        {
            IDTSOutputColumn100 col = Component.OutputCollection[0].OutputColumnCollection.New();

            col.Name = column.Name;

            col.ErrorRowDisposition      = DTSRowDisposition.RD_IgnoreFailure;
            col.TruncationRowDisposition = DTSRowDisposition.RD_FailComponent;

            // TODO: Workaround for AstDesigner bug where IsExplicitlySet isn't working
            col.SetDataTypeProperties(
                GetDataTypeFromString(column.DerivedColumnType),
                column.IsLengthExplicitlySet || column.Length > 0 ? column.Length : 0,
                column.IsPrecisionExplicitlySet || column.Precision > 0 ? column.Precision : 0,
                column.IsScaleExplicitlySet || column.Scale > 0 ? column.Scale : 0,
                column.IsCodepageExplicitlySet || column.Codepage > 0 ? column.Codepage : 0);
            col.ExternalMetadataColumnID   = 0;
            col.ErrorOrTruncationOperation = "Computation";

            IDTSVirtualInput100 vi = Component.InputCollection[0].GetVirtualInput();

            IDTSCustomProperty100 propExpression = col.CustomPropertyCollection.New();

            propExpression.Name = "Expression";
            Expression exp = ExpressionHandler.ExpressionCleanerAndInputMapBuilder(column.Expression.Trim(), this, vi, DTSUsageType.UT_READONLY);

            propExpression.Value      = exp.ProcessedExpression;
            propExpression.ContainsID = exp.ContainsId;

            IDTSCustomProperty100 propFriendlyExpression = col.CustomPropertyCollection.New();

            propFriendlyExpression.Name           = "FriendlyExpression";
            propFriendlyExpression.Value          = exp.FriendlyExpression;
            propFriendlyExpression.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
            propFriendlyExpression.ContainsID     = exp.ContainsId;
        }