Esempio n. 1
0
        private void Initialize(ExecutePackageTask execPackage)
        {
            string expression;

            if (Path.IsPathRooted(execPackage.RelativePath))
            {
                expression = String.Format("\"{0}\"", execPackage.RelativePath);
            }
            else
            {
                expression = SSISExpressionPathBuilder.BuildExpressionPath
                    (
                    Context.Package.PackageRelativeDirectory 
                    + Path.DirectorySeparatorChar 
                    + execPackage.RelativePath
                    );
            }

            string name = execPackage.RelativePath.Replace(Path.DirectorySeparatorChar, '_');
            name = name.Replace('.', '_');
            _execPackageTaskHost.Name = name + Guid.NewGuid().ToString();

            ConnectionConfiguration config = new ConnectionConfiguration();
            config.Name = name;
            config.Type = "FILE";
            config.ConnectionString = expression;

            SsisConnection connection = new SsisConnection(config);
            
            SSISTask.Connection = connection.ConnectionManager.Name;
        }
Esempio n. 2
0
        protected void InitializeConnection(string sConnection)
        {
            _sourceConnection = new SsisConnection(sConnection);

            if (_component.RuntimeConnectionCollection.Count > 0)
            {
                _component.RuntimeConnectionCollection[0].ConnectionManager =
                    DTS.DtsConvert.GetExtendedInterface(_sourceConnection.ConnectionManager);
                _component.RuntimeConnectionCollection[0].ConnectionManagerID = _sourceConnection.ConnectionManager.ID;
            }
        }
Esempio n. 3
0
        public override SSISEmitterContext Emit()
        {
            this.UnSave();
            this.Save();

            SSISEmitterContext newContext = null;

            try
            {
                Package logicalPackage = (Package)_logicalContainer;
                this.DTSPackage.Variables.Add("_vulcanPackageRepositoryDirectory", false, "User", OutputBaseDirectory);

                foreach (ConnectionConfiguration connection in logicalPackage.ConnectionConfigurationList)
                {
                    this.AddConfiguration(connection.Name);
                    SsisConnection s = new SsisConnection(connection);
                }

                foreach (PackageConfiguration config in logicalPackage.PackageConfigurationList)
                {
                    this.AddConfiguration(config.Name);
                }

                foreach (Variable variable in logicalPackage.VariableList)
                {
                    SsisVariable s = new SsisVariable(variable);
                }

                this.Reload();

                newContext = new SSISEmitterContext(this, new SsisSequence(this.DTSPackage, _logicalContainer), _context.PluginLoader);
                this.DTSPackage.TransactionOption = (Microsoft.SqlServer.Dts.Runtime.DTSTransactionOption)
                                                    Enum.Parse(typeof(Microsoft.SqlServer.Dts.Runtime.DTSTransactionOption), this.LogicalPackage.TransactionMode);
                EmitPatterns(newContext);
                this.Save();
            }
            catch (Exception e)
            {
                this.Save();
                MessageEngine.Global.Trace(Severity.Error, e, e.Message);
            }

            return(newContext);
        }
Esempio n. 4
0
        public SSISEmitterContext Emit()
        {
            SetResultSetType(_logicalExecuteSQL.ResultSet);

            switch (_logicalExecuteSQL.Type.ToUpper(System.Globalization.CultureInfo.InvariantCulture))
            {
                case "EXPRESSION":
                    SSISTask.SqlStatementSource = Resources.Placeholder;
                    SetExpression("SqlStatementSource", _logicalExecuteSQL.Body);
                    break;
                default: // case "FILE":
                    //TODO: solve the name conflicts if necessary.
                    string sqlFilePath;
                    string sqlFileRelativePath;
                    ConnectionConfiguration config = new ConnectionConfiguration();
                    config.Name = Name;
                    config.Type = "FILE";
                    WriteSQLToFile(_logicalExecuteSQL.Body, out sqlFilePath, out sqlFileRelativePath);
                    config.ConnectionString = SSISExpressionPathBuilder.BuildExpressionPath(sqlFileRelativePath);
                    
                    SsisConnection connection = new SsisConnection(config);
                    SSISTask.SqlStatementSource = connection.ConnectionManager.Name;
                    Context.Package.ProjectManager.MiscFiles.Add(Name + Resources.ExtensionSQLFile);
                    break;

            }

            int index = 0;
            foreach (ExecuteSQLParameter param in _logicalExecuteSQL.ParameterList)
            {
                BindParameter(new SsisVariable(param.Variable, Context).DTSVariable, param.Direction, index.ToString(), (int)param.OleDbType, 255);
                index++;
            }
            
            foreach (ExecuteSQLResult executeSQLResult in _logicalExecuteSQL.ResultList)
            {
                BindResult(executeSQLResult.Name, executeSQLResult.VariableName);
            }
            
            ExecuteSQLTask(_logicalExecuteSQL.ExecuteDuringDesignTime);

            return _context;
        }
Esempio n. 5
0
        public override SSISEmitterContext Emit()
        {
            this.UnSave();
            this.Save();

            SSISEmitterContext newContext = null;

            try
            {
                Package logicalPackage = (Package)_logicalContainer;
                this.DTSPackage.Variables.Add("_vulcanPackageRepositoryDirectory", false, "User", OutputBaseDirectory);

                foreach (ConnectionConfiguration connection in logicalPackage.ConnectionConfigurationList)
                {
                    this.AddConfiguration(connection.Name);
                    SsisConnection s = new SsisConnection(connection);
                }

                foreach (PackageConfiguration config in logicalPackage.PackageConfigurationList)
                {
                    this.AddConfiguration(config.Name);
                }

                foreach (Variable variable in logicalPackage.VariableList)
                {
                    SsisVariable s = new SsisVariable(variable);
                }

                this.Reload();

                newContext = new SSISEmitterContext(this, new SsisSequence(this.DTSPackage, _logicalContainer), _context.PluginLoader);
                this.DTSPackage.TransactionOption = (Microsoft.SqlServer.Dts.Runtime.DTSTransactionOption)
                    Enum.Parse(typeof(Microsoft.SqlServer.Dts.Runtime.DTSTransactionOption), this.LogicalPackage.TransactionMode);
                EmitPatterns(newContext);
                this.Save();

            }
            catch (Exception e)
            {
                this.Save();
                MessageEngine.Global.Trace(Severity.Error, e, e.Message);
            }

            return newContext;
        }