public object[][] Execute(string connectionString) { var results = new List <object[]>(); var executionStack = new Stack <ICommandMultiAccessor>(); //unravel the stack of commands ICommandMultiAccessor stackIndex = this; //hack to execute that last single command.... ICommandAccessor <object> firstCommand = null; while (stackIndex != null) { executionStack.Push(stackIndex); if (stackIndex.PreviousMultiCommand == null) { firstCommand = stackIndex.PreviousCommand; } stackIndex = stackIndex.PreviousMultiCommand; } using (var connection = new SqlConnection(connectionString)) { connection.Open(); results.Add(firstCommand.ExecuteConnection(connection)); while (executionStack.Count > 0) { results.Add(executionStack.Pop().ExecuteLocal(connection)); } } return(results.ToArray()); }
public void Initialize(string tablePrefix, string schedName, ICommandAccessor commandAccessor) { this.tablePrefix = tablePrefix; schedNameLiteral = "'" + schedName + "'"; this.commandAccessor = commandAccessor; }
internal DwCommandMulti(string sql, object parameters, ICommandAccessor <object> previousCommand) { this.Sql = sql; this.Parameters = parameters; this.PreviousCommand = previousCommand; }