Deveel.Data.Sql.Query.QueryTablePlanner.AddPlan C# (CSharp) Method

AddPlan() public method

public AddPlan ( IQueryPlanNode plan, IFromTableSource tableSource ) : void
plan IQueryPlanNode
tableSource IFromTableSource
return void
        public void AddPlan(IQueryPlanNode plan, IFromTableSource tableSource)
        {
            var columns = tableSource.ColumnNames;
            var uniqueNames = new[] {tableSource.UniqueName};
            AddPlan(new TablePlan(plan, columns, uniqueNames));
        }

Same methods

QueryTablePlanner::AddPlan ( TablePlan tablePlan ) : void

Usage Example

Ejemplo n.º 1
0
        private QueryTablePlanner CreateTablePlanner(IRequest context, QueryExpressionFrom queryFrom)
        {
            // Set up plans for each table in the from clause of the command.  For
            // sub-queries, we recurse.

            var tablePlanner = new QueryTablePlanner();

            for (int i = 0; i < queryFrom.SourceCount; i++)
            {
                var            tableSource = queryFrom.GetTableSource(i);
                IQueryPlanNode plan;

                if (tableSource is FromTableSubQuerySource)
                {
                    var subQuerySource = (FromTableSubQuerySource)tableSource;

                    var subQueryExpr = subQuerySource.QueryExpression;
                    var subQueryFrom = subQuerySource.QueryFrom;

                    plan = PlanQuery(context, subQueryExpr, subQueryFrom, null, null);

                    if (!(plan is SubsetNode))
                    {
                        throw new InvalidOperationException("The root node of a sub-query plan must be a subset.");
                    }

                    var subsetNode = (SubsetNode)plan;
                    subsetNode.SetAliasParentName(subQuerySource.AliasName);
                }
                else if (tableSource is FromTableDirectSource)
                {
                    var directSource = (FromTableDirectSource)tableSource;
                    plan = directSource.QueryPlan;
                }
                else
                {
                    throw new InvalidOperationException(String.Format("The type of FROM source '{0}' is not supported.", tableSource.GetType()));
                }

                tablePlanner.AddPlan(plan, tableSource);
            }

            return(tablePlanner);
        }
All Usage Examples Of Deveel.Data.Sql.Query.QueryTablePlanner::AddPlan