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