Beispiel #1
0
        public static long Execute(this PackageInfo @this, bool use32RuntimeOn64, EnvironmentReference reference, Collection <PackageInfo.ExecutionValueParameterSet> setValueParameters, int commandTimeout)
        {
            object obj = SqlHelper.ExecuteSQLCommand(((IntegrationServices)@this.GetDomain()).Connection, CommandType.Text, @this.ScriptCreateExecution(use32RuntimeOn64, reference), null, ExecuteType.ExecuteScalar, commandTimeout);

            if (setValueParameters != null && setValueParameters.Count > 0)
            {
                var param = new SqlParameter("execution_id", SqlDbType.Int);
                param.Value = obj;
                SqlParameter[] array = new SqlParameter[]
                {
                    param
                };

                SqlHelper.ExecuteSQLCommand(((IntegrationServices)@this.GetDomain()).Connection, CommandType.Text, @this.ScriptSetExecutionValues(setValueParameters), array, ExecuteType.ExecuteNonQuery, commandTimeout);
            }

            var param3 = new SqlParameter("execution_id", SqlDbType.Int);

            param3.Value = obj;
            SqlParameter[] array3 = new SqlParameter[]
            {
                param3
            };

            SqlHelper.ExecuteSQLCommand(((IntegrationServices)@this.GetDomain()).Connection, CommandType.Text, @this.ScriptStartExecution(), array3, ExecuteType.ExecuteNonQuery, commandTimeout);
            return((long)obj);
        }
Beispiel #2
0
        private static string ScriptCreateExecution(this PackageInfo @this, bool use32RuntimeOn64, EnvironmentReference reference)
        {
            if (use32RuntimeOn64)
            {
                string platform = Helpers.GetPlatform(@this.GetDomain() as IntegrationServices);
                if (platform != null && !platform.Contains("64"))
                {
                    throw new InvalidArgumentException($"Use32RuntimeOn64_Not64: {use32RuntimeOn64}");
                }
            }

            SfcTsqlProcFormatter sfcTsqlProcFormatter = new SfcTsqlProcFormatter();

            sfcTsqlProcFormatter.Procedure = string.Format(CultureInfo.InvariantCulture, "[{0}].[catalog].[create_execution]", new object[]
            {
                Helpers.GetEscapedName(@this.Parent.Parent.Parent.Name)
            });

            sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("package_name", "Name", true, false));
            List <SfcTsqlProcFormatter.RuntimeArg> list = new List <SfcTsqlProcFormatter.RuntimeArg>();
            long num = 0L;

            SfcTsqlProcFormatter.RuntimeArg item = new SfcTsqlProcFormatter.RuntimeArg(typeof(long), num);
            list.Add(item);
            sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("execution_id", true, true));
            item = new SfcTsqlProcFormatter.RuntimeArg(typeof(string), @this.Parent.Parent.Name);
            list.Add(item);
            sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("folder_name", true));
            item = new SfcTsqlProcFormatter.RuntimeArg(typeof(string), @this.Parent.Name);
            list.Add(item);
            sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("project_name", true));
            item = new SfcTsqlProcFormatter.RuntimeArg(typeof(bool), use32RuntimeOn64);
            list.Add(item);
            sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("use32bitruntime", true));
            SqlInt64 sqlInt = (reference != null) ? reference.ReferenceId : SqlInt64.Null;

            item = new SfcTsqlProcFormatter.RuntimeArg(typeof(SqlInt64), sqlInt);
            list.Add(item);
            sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("reference_id", true));
            Version serverVersion = ((IntegrationServices)@this.GetDomain()).Connection.ServerVersion;

            if (serverVersion.Major >= 14)
            {
                if (serverVersion >= new Version(14, 0, 700))
                {
                    item = new SfcTsqlProcFormatter.RuntimeArg(typeof(bool), false);
                    list.Add(item);
                    sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("runinscaleout", true));
                }
                else
                {
                    item = new SfcTsqlProcFormatter.RuntimeArg(typeof(bool), false);
                    list.Add(item);
                    sfcTsqlProcFormatter.Arguments.Add(new SfcTsqlProcFormatter.SprocArg("runincluster", true));
                }
            }

            return(sfcTsqlProcFormatter.GenerateScript(@this, list));
        }