コード例 #1
0
        public static QsiColumnsDeclarationNode VisitColumnListClause(ColumnListClauseContext context, QsiSequentialColumnType?sequence)
        {
            var node = VisitColumnList(context.cl, sequence);

            HanaTree.PutContextSpan(node, context);
            return(node);
        }
コード例 #2
0
        public static IQsiDefinitionNode VisitCreateViewStatement(CreateViewStatementContext context)
        {
            var node = new HanaViewDefinitionNode
            {
                Identifier = context.name,
                Comment    = context.comment,
                StructuredPrivilegeCheck = context.structuredPrivilegeCheck,
                Force       = context.force,
                CheckOption = context.checkOption,
                DdlOnly     = context.ddlOnly,
                ReadOnly    = context.readOnly
            };

            if (context.TryGetRuleContext <ColumnListClauseContext>(out var columnList))
            {
                node.Columns.SetValue(TableVisitor.VisitColumnListClause(columnList, null));
            }

            if (context.TryGetRuleContext <ParameterizedViewClauseContext>(out var parameterizedViewClause))
            {
                node.Parameters.SetValue(TreeHelper.Fragment(parameterizedViewClause.GetInputText()));
            }

            node.Source.SetValue(TableVisitor.VisitSelectStatement(context.selectStatement()));

            if (context.TryGetRuleContext <WithAssociationClauseContext>(out var withAssociationClause))
            {
                node.Associations.SetValue(TreeHelper.Fragment(withAssociationClause.GetInputText()));
            }

            if (context.TryGetRuleContext <WithMaskClauseContext>(out var withMaskClause))
            {
                node.Masks.SetValue(TreeHelper.Fragment(withMaskClause.GetInputText()));
            }

            if (context.TryGetRuleContext <WithExpressionMacroClauseContext>(out var withExpressionMacroClause))
            {
                node.ExpressionMacros.SetValue(TreeHelper.Fragment(withExpressionMacroClause.GetInputText()));
            }

            if (context.TryGetRuleContext <WithAnnotationClauseContext>(out var withAnnotationClause))
            {
                node.Annotation.SetValue(TreeHelper.Fragment(withAnnotationClause.GetInputText()));
            }

            if (context.TryGetRuleContext <WithCacheClauseContext>(out var withCacheClause))
            {
                node.Cache.SetValue(TreeHelper.Fragment(withCacheClause.GetInputText()));
            }

            if (context.TryGetRuleContext <WithAnonymizationClauseContext>(out var withAnonymizationClause))
            {
                node.Anonymization.SetValue(TreeHelper.Fragment(withAnonymizationClause.GetInputText()));
            }

            HanaTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #3
0
        public static QsiColumnsDeclarationNode VisitColumnList(ColumnListContext context, QsiSequentialColumnType?sequence)
        {
            var node = new QsiColumnsDeclarationNode();

            node.Columns.AddRange(context.list.Select(x => CreateColumnNode(x, sequence)));
            HanaTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #4
0
        public static QsiTableDirectivesNode VisitWithClause(WithClauseContext context)
        {
            var node = new QsiTableDirectivesNode();

            node.Tables.AddRange(context._elements.Select(VisitWithListElement));

            HanaTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #5
0
        public static QsiDataDeleteActionNode VisitDeleteStatement(DeleteStatementContext context)
        {
            var partitionRestriction = context.partitionRestriction();
            var whereClause          = context.whereClause();
            var hintClause           = context.hintClause();

            QsiTableNode tableNode = new HanaTableReferenceNode
            {
                Identifier = context.tableName().qqi
            };

            if (partitionRestriction != null)
            {
                ((HanaTableReferenceNode)tableNode).Partition.Value = TreeHelper.Fragment(partitionRestriction.GetInputText());
            }

            if (whereClause != null || hintClause != null)
            {
                var derivedTableNode = new HanaDerivedTableNode
                {
                    Columns = { Value = TreeHelper.CreateAllColumnsDeclaration() },
                    Source  = { Value = tableNode }
                };

                if (whereClause != null)
                {
                    derivedTableNode.Where.Value = ExpressionVisitor.VisitWhereClause(whereClause);
                }

                if (hintClause != null)
                {
                    derivedTableNode.Hint.Value = TreeHelper.Fragment(hintClause.GetInputText());
                }

                tableNode = derivedTableNode;
            }

            var node = new QsiDataDeleteActionNode
            {
                Target = { Value = tableNode }
            };

            HanaTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #6
0
        public static QsiDerivedTableNode VisitWithListElement(WithListElementContext context)
        {
            var node = new QsiDerivedTableNode();

            node.Alias.SetValue(new QsiAliasNode
            {
                Name = context.name.qi
            });

            var columnListClause = context.columnListClause();

            node.Columns.SetValue(
                columnListClause != null ?
                VisitColumnListClause(columnListClause, QsiSequentialColumnType.Default) :
                TreeHelper.CreateAllColumnsDeclaration()
                );

            node.Source.SetValue(VisitSubquery(context.subquery()));

            HanaTree.PutContextSpan(node, context);

            return(node);
        }