Ejemplo n.º 1
0
 public static QsiTableExpressionNode VisitSelectStatement(SelectStatementContext context)
 {
     return(TreeHelper.Create <QsiTableExpressionNode>(n =>
     {
         n.Table.SetValue(TableVisitor.VisitSelectStatement(context));
     }));
 }
Ejemplo n.º 2
0
        public SelectStatement ParseSelectStatement(SelectStatementContext node)
        {
            SelectStatement statement = new SelectStatement();

            foreach (var child in node.children)
            {
                if (child is QuerySpecificationContext query)
                {
                    statement = this.ParseQuerySpecification(query);
                }
                else if (child is UnionSelectContext union)
                {
                    statement = this.ParseUnionSelect(union);
                }
                else if (child is QueryExpressionContext exp)
                {
                    QuerySpecificationContext querySpec = exp.querySpecification();

                    if (querySpec != null)
                    {
                        statement = this.ParseQuerySpecification(querySpec);
                    }
                }
            }

            return(statement);
        }
Ejemplo n.º 3
0
        public static SelectQueryInfo VisitSelectStatement(SelectStatementContext context)
        {
            switch (context)
            {
            case SimpleSelectContext simpleSelectContext:
                return(VisitSimpleSelectContext(simpleSelectContext));

            case ParenthesisSelectContext parenthesisSelectContext:
                return(VisitQueryExpression(parenthesisSelectContext.queryExpression()));
            }

            return(VisitorHelper.ThrowNotSupportedContext <SelectQueryInfo>(context));
        }
Ejemplo n.º 4
0
        public static QsiTableNode VisitSelectStatement(SelectStatementContext context)
        {
            switch (context)
            {
            case SimpleSelectContext simpleSelectContext:
                return(VisitQuerySpecification(simpleSelectContext.querySpecification()));

            case ParenthesisSelectContext parenthesisSelectContext:
                return(VisitQueryExpression(parenthesisSelectContext.queryExpression()));
            }

            return(null);
        }
Ejemplo n.º 5
0
        public static QsiTableNode VisitSelectStatement(SelectStatementContext context)
        {
            var withClause = context.withClause();
            var subquery   = context.subquery();
            var forClause  = context.forClause();
            var timeTravel = context.timeTravel();
            var hintClause = context.hintClause();

            var subqueryNode = VisitSubquery(subquery);

            if (withClause is null && forClause is null && timeTravel is null && hintClause is null)
            {
                return(subqueryNode);
            }

            if (subqueryNode is not HanaDerivedTableNode derivedTableNode)
            {
                derivedTableNode = new HanaDerivedTableNode
                {
                    Columns = { Value = TreeHelper.CreateAllColumnsDeclaration() },
                    Source  = { Value = subqueryNode }
                };
            }

            if (withClause is not null)
            {
                derivedTableNode.Directives.SetValue(VisitWithClause(withClause));
            }

            if (forClause is not null)
            {
                derivedTableNode.Behavior.SetValue(VisitForClause(forClause));
            }

            if (timeTravel is not null)
            {
                derivedTableNode.TimeTravel.SetValue(TreeHelper.Fragment(timeTravel.GetInputText()));
            }

            if (hintClause is not null)
            {
                derivedTableNode.Hint.SetValue(TreeHelper.Fragment(hintClause.GetInputText()));
            }

            return(derivedTableNode);
        }
Ejemplo n.º 6
0
        public static QsiTableNode VisitSelectStatement(SelectStatementContext context)
        {
            switch (context.children[0])
            {
            case QueryExpressionContext queryExpression:
                var commonContext = new CommonQueryContext(queryExpression, context.lockingClauseList());
                return(VisitQueryExpression(commonContext));

            case QueryExpressionParensContext queryExpressionParens:
                return(VisitQueryExpressionParens(queryExpressionParens));

            case SelectStatementWithIntoContext selectStatementWithInto:
                return(VisitSelectStatementWithInto(selectStatementWithInto));

            default:
                throw TreeHelper.NotSupportedTree(context.children[0]);
            }
        }
Ejemplo n.º 7
0
 public static QsiTableNode VisitSelectStatement(SelectStatementContext context)
 {
     return(VisitCommonSelectStatement(new CommonSelectStatementContext(context)));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// build the XPTNode of a select statement 
 /// </summary>
 /// <param name="ctx"></param>
 /// <returns></returns>
 public bool BuildXPTNode(SelectStatementContext ctx)
 {
     return true;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// build the XPTNode of a select statement
 /// </summary>
 /// <param name="ctx"></param>
 /// <returns></returns>
 public bool BuildXPTNode(SelectStatementContext ctx)
 {
     return(true);
 }