Beispiel #1
0
        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());
        }
Beispiel #2
0
 public void Initialize(string tablePrefix, string schedName, ICommandAccessor commandAccessor)
 {
     this.tablePrefix     = tablePrefix;
     schedNameLiteral     = "'" + schedName + "'";
     this.commandAccessor = commandAccessor;
 }
 public void Initialize(string tablePrefix, string schedName, ICommandAccessor commandAccessor)
 {
     this.tablePrefix = tablePrefix;
     schedNameLiteral = "'" + schedName + "'";
     this.commandAccessor = commandAccessor;
 }
Beispiel #4
0
 internal DwCommandMulti(string sql, object parameters, ICommandAccessor <object> previousCommand)
 {
     this.Sql             = sql;
     this.Parameters      = parameters;
     this.PreviousCommand = previousCommand;
 }