Esempio n. 1
0
        internal static ProviderCommandInfo Create(Command command, System.Data.Entity.Core.Query.InternalTrees.Node node)
        {
            PhysicalProjectOp op = node.Op as PhysicalProjectOp;

            System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(op != null, "Expected root Op to be a physical Project");
            DbCommandTree      commandTree      = CTreeGenerator.Generate(command, node);
            DbQueryCommandTree queryCommandTree = commandTree as DbQueryCommandTree;

            System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(queryCommandTree != null, "null query command tree");
            CollectionType edmType = TypeHelpers.GetEdmType <CollectionType>(queryCommandTree.Query.ResultType);

            System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(TypeSemantics.IsRowType(edmType.TypeUsage), "command rowtype is not a record");
            ProviderCommandInfoUtils.BuildOutputVarMap(op, edmType.TypeUsage);
            return(new ProviderCommandInfo(commandTree));
        }
Esempio n. 2
0
        private void Process(
            out List <ProviderCommandInfo> childCommands,
            out ColumnMap resultColumnMap,
            out int columnCount)
        {
            PhysicalProjectOp op = (PhysicalProjectOp)this.Command.Root.Op;

            this.m_subCommands = new List <System.Data.Entity.Core.Query.InternalTrees.Node>((IEnumerable <System.Data.Entity.Core.Query.InternalTrees.Node>) new System.Data.Entity.Core.Query.InternalTrees.Node[1]
            {
                this.Command.Root
            });
            childCommands = new List <ProviderCommandInfo>((IEnumerable <ProviderCommandInfo>) new ProviderCommandInfo[1]
            {
                ProviderCommandInfoUtils.Create(this.Command, this.Command.Root)
            });
            resultColumnMap = this.BuildResultColumnMap(op);
            columnCount     = op.Outputs.Count;
        }
Esempio n. 3
0
        // <summary>
        // The real driver. This routine walks the tree, converts each subcommand
        // into a CTree, and converts the columnmap into a real column map.
        // Finally, it produces a "real" plan that can be used by the bridge execution, and
        // returns this plan
        // The root of the tree must be a PhysicalProjectOp. Each child of this Op
        // represents a command to be executed, and the ColumnMap of this Op represents
        // the eventual columnMap to be used for result assembly
        // </summary>
        // <param name="childCommands"> CQTs for store commands </param>
        // <param name="resultColumnMap"> column map for result assembly </param>
        private void Process(out List <ProviderCommandInfo> childCommands, out ColumnMap resultColumnMap, out int columnCount)
        {
            var projectOp = (PhysicalProjectOp)Command.Root.Op;

            m_subCommands = new List <Node>(new[] { Command.Root });
            childCommands = new List <ProviderCommandInfo>(
                new[]
            {
                ProviderCommandInfoUtils.Create(
                    Command,
                    Command.Root         // input node
                    )
            });

            // Build the final column map, and count the columns we expect for it.
            resultColumnMap = BuildResultColumnMap(projectOp);

            columnCount = projectOp.Outputs.Count;
        }