/// <summary> /// Setups the script execution /// </summary> /// <param name="scriptExecutionArgs"></param> private void ExecuteInternal(ScriptExecutionArgs scriptExecutionArgs, bool isBatchParser) { Validate.IsNotNull(nameof(scriptExecutionArgs), scriptExecutionArgs); Validate.IsNotNullOrEmptyString(nameof(scriptExecutionArgs.Script), scriptExecutionArgs.Script); Validate.IsNotNull(nameof(scriptExecutionArgs.ReliableConnection), scriptExecutionArgs.ReliableConnection); Validate.IsNotNull(nameof(scriptExecutionArgs.Conditions), scriptExecutionArgs.Conditions); Validate.IsNotNull(nameof(scriptExecutionArgs.BatchEventHandlers), scriptExecutionArgs.BatchEventHandlers); Debug.Assert(scriptExecutionArgs.TimeOut >= 0); executionTimeout = scriptExecutionArgs.TimeOut < 0 ? 0 : scriptExecutionArgs.TimeOut; connection = scriptExecutionArgs.ReliableConnection; conditions = new ExecutionEngineConditions(scriptExecutionArgs.Conditions); script = scriptExecutionArgs.Script; isSqlCmdConnection = false; batchEventHandlers = scriptExecutionArgs.BatchEventHandlers; startingLine = scriptExecutionArgs.StartingLine; internalVariables = scriptExecutionArgs.Variables; DoExecute(isBatchParser); }
/// <summary> /// Executes a given batch /// </summary> /// <param name="batchScript"></param> /// <returns></returns> public void ExecuteBatch(ScriptExecutionArgs scriptExecutionArgs) { ExecuteInternal(scriptExecutionArgs, /* isBatchParser */ false); }