GetTableSource() public method

public GetTableSource ( int offset ) : IFromTableSource
offset int
return IFromTableSource
Esempio n. 1
0
 public void SelectAllColumnsFromAllSources()
 {
     for (int p = 0; p < fromSet.SourceCount; ++p)
     {
         IFromTableSource table = fromSet.GetTableSource(p);
         AddAllFromTable(table);
     }
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
        private QueryTablePlanner CreateTablePlanner(IQueryContext 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);

                    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;
        }