Exemplo n.º 1
0
        private CMExecuteSQLNonQuery CreateMainCommand(IExecutionContext context, string commandGuid)
        {
            List <SqlParameterClass> parameters = InitFilelistParameters(context);

            context.Log.AddLogInformation("Параметры SQL-команды RESTORE_FILELIST инициализированы");
            string            resultSetCtxName         = Guid.NewGuid().ToString("N");
            string            absoluteConnectionString = context.GetStringFrom(ConnectionString);
            CMExecuteSQLQuery query = new CMExecuteSQLQuery()
            {
                CommandType      = CommandType.Text,
                CommandText      = RESTORE_FILELIST_TEMPLATE.Replace("{command_guid}", commandGuid),
                CommandTimeout   = CommandTimeout,
                ConnectionString = absoluteConnectionString,
                Parameters       = parameters,
                ResultName       = resultSetCtxName
            };

            query.Do(context);
            context.Log.AddLogInformation("SQL-команда RESTORE_FILELIST выполнена");

            parameters = InitRestoreParameters(context, resultSetCtxName);
            context.Log.AddLogInformation("Параметры SQL-команды RESTORE_DATABASE инициализированы");
            CMExecuteSQLNonQuery cmd = new CMExecuteSQLNonQuery()
            {
                CommandType      = CommandType.Text,
                CommandText      = QUERY_RESTORE_BACKUP_TEMPLATE,
                CommandTimeout   = CommandTimeout,
                ConnectionString = absoluteConnectionString,
                Parameters       = parameters
            };

            return(cmd);
        }
Exemplo n.º 2
0
        private CMExecuteSQLNonQuery CreateMainCommand(IExecutionContext context, string commandGuid)
        {
            List<SqlParameterClass> parameters = InitFilelistParameters(context);
            context.Log.AddLogInformation("Параметры SQL-команды RESTORE_FILELIST инициализированы");
            string resultSetCtxName = Guid.NewGuid().ToString("N");
            string absoluteConnectionString = context.GetStringFrom(ConnectionString);
            CMExecuteSQLQuery query = new CMExecuteSQLQuery()
            {
                CommandType = CommandType.Text,
                CommandText = RESTORE_FILELIST_TEMPLATE.Replace("{command_guid}", commandGuid),
                CommandTimeout = CommandTimeout,
                ConnectionString = absoluteConnectionString,
                Parameters = parameters,
                ResultName = resultSetCtxName
            };
            query.Do(context);
            context.Log.AddLogInformation("SQL-команда RESTORE_FILELIST выполнена");

            parameters = InitRestoreParameters(context, resultSetCtxName);
            context.Log.AddLogInformation("Параметры SQL-команды RESTORE_DATABASE инициализированы");
            CMExecuteSQLNonQuery cmd = new CMExecuteSQLNonQuery()
            {
                CommandType = CommandType.Text,
                CommandText = QUERY_RESTORE_BACKUP_TEMPLATE,
                CommandTimeout = CommandTimeout,
                ConnectionString = absoluteConnectionString,
                Parameters = parameters
            };
            return cmd;
        }