Exemple #1
0
        public static PrimarSqlSetColumnExpressionNode VisitUpdatedElement(UpdatedElementContext context)
        {
            var column = IdentifierVisitor.VisitFullColumnName(context.fullColumnName());

            var assignNode = new PrimarSqlSetColumnExpressionNode
            {
                Target = column.Name,
            };

            assignNode.Accessors.AddRange(column.Accessors);

            QsiExpressionNode expression;

            if (context.expression() != null)
            {
                expression = VisitExpression(context.expression());
            }
            else if (context.arrayExpression() != null)
            {
                expression = VisitArrayExpression(context.arrayExpression());
            }
            else if (context.arrayAddExpression() != null)
            {
                expression = VisitArrayAddExpression(context.arrayAddExpression());
            }
            else
            {
                expression = TreeHelper.CreateNullLiteral();
            }

            assignNode.Value.SetValue(expression);

            PrimarSqlTree.PutContextSpan(assignNode, context);
            return(assignNode);
        }
Exemple #2
0
        private static QsiColumnExpressionNode VisitFullColumnName(FullColumnNameContext context)
        {
            return(TreeHelper.Create <QsiColumnExpressionNode>(n =>
            {
                n.Column.SetValue(IdentifierVisitor.VisitFullColumnName(context));

                PrimarSqlTree.PutContextSpan(n.Column.Value, context);
                PrimarSqlTree.PutContextSpan(n, context);
            }));
        }
Exemple #3
0
        public static PrimarSqlSetColumnExpressionNode VisitRemovedElement(RemovedElementContext context)
        {
            var column = IdentifierVisitor.VisitFullColumnName(context.fullColumnName());

            var assignNode = new PrimarSqlSetColumnExpressionNode
            {
                Target = column.Name,
            };

            assignNode.Accessors.AddRange(column.Accessors);

            PrimarSqlTree.PutContextSpan(assignNode, context);
            return(assignNode);
        }
Exemple #4
0
        public static QsiColumnNode VisitSelectColumnElement(SelectColumnElementContext context)
        {
            var nameContext = context.fullColumnName();
            var column      = IdentifierVisitor.VisitFullColumnName(nameContext);

            if (context.alias == null)
            {
                return(column);
            }

            return(TreeHelper.Create <QsiDerivedColumnNode>(n =>
            {
                n.Column.SetValue(column);
                n.Alias.SetValue(CreateAliasNode(context.alias));
            }));
        }