Example #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;
        }
Example #2
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);
        }
Example #3
0
        private void AddConfiguration(string configurationName)
        {
            DTSPackage.EnableConfigurations = true;

            string packageRoot =
                String.IsNullOrEmpty(VulcanEngine.Common.PathManager.PackageConfigurationPath)
                ? Settings.Default.DetegoPackageConfigurationRoot
                : VulcanEngine.Common.PathManager.PackageConfigurationPath;

            string configFilePath =
                SSISExpressionPathBuilder.BuildAbsoluteExpressionPath(packageRoot
                                                                      + Path.DirectorySeparatorChar
                                                                      + configurationName
                                                                      + "."
                                                                      + Resources.ExtensionDtsConfigurationFile);

            MessageEngine.Global.Trace(Severity.Debug, "Adding Configuration File {0}", configFilePath);

            DTS.Configuration config = DTSPackage.Configurations.Add();
            config.ConfigurationType = DTS.DTSConfigurationType.ConfigFile;
            config.Name                = configurationName;
            config.Description         = configurationName;
            config.ConfigurationString = configFilePath;
        }