Esempio n. 1
0
 public override void Emit(SsisEmitterContext context)
 {
     base.Emit(context);
     var fc = new FileConnection(Name + _relativePath, _relativePath);
     fc.Initialize(context);
     fc.Emit(context);
     ExecutePackageTaskObject.Connection = fc.Name;
 }
Esempio n. 2
0
        public override void Emit(SsisEmitterContext context)
        {
            base.Emit(context);
            _connection.Emit(context);
            SetProperty("Connection", _connection.Name);

            ExecuteSqlTask.ResultSetType = _resultSetTypeDTS;
            ExecuteSqlTask.SqlStatementSourceType = _sourceStatementTypeDTS;

            switch (_sourceStatementType)
            {
                case SqlTaskStatementType.File:
                    string filePath;
                    string fileName;
                    _writeSqlToFile(context, out fileName, out filePath);

                    var fileConnection = new FileConnection(fileName, filePath);
                    fileConnection.Initialize(context);
                    fileConnection.Emit(context);
                    ExecuteSqlTask.SqlStatementSource = fileConnection.Name;

                    break;
                case SqlTaskStatementType.Expression:

                    ExecuteSqlTask.SqlStatementSource = Properties.Resources.Placeholder;
                    SetExpression("SqlStatementSource", _body);
                    break;
                default:
                    throw new NotSupportedException(String.Format(CultureInfo.InvariantCulture, Properties.Resources.ErrorEnumerationTypeNotSupported, _sourceStatementType));
            }

            // Parameter Binding
            int index = 0;
            foreach (ExecuteSqlParameter param in Parameters.Values)
            {
                BindParameter(param.VariableName, param.Direction, param.Name, (int)param.OleDBType, param.Length);
                index++;
            }

            foreach (ExecuteSqlResult executeSqlResult in Results.Values)
            {
                BindResult(executeSqlResult.Name, executeSqlResult.VariableName);
            }

            TryExecuteDuringDesignTime();
        }