A visitor for SqlExpression objects.
 public override SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return(visitor.VisitQuery(this));
 }
Esempio n. 2
0
        public ExpressionParseResult ParseExpression(string text)
        {
            SetInput(text);
            //var plSqlParser = MakeParser(text, null);
            var parseResult = plSqlParser.expressionUnit();

            var visitor = new SqlExpressionVisitor();
            var result = visitor.Visit(parseResult);

            var errors = messages.Where(x => x.Level == CompileMessageLevel.Error).Select(x => x.Text).ToArray();
            if (errors.Length > 0)
                return new ExpressionParseResult(errors);

            return new ExpressionParseResult(result);
        }
Esempio n. 3
0
 public override SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return(visitor.VisitConstant(this));
 }
Esempio n. 4
0
 public override SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return(visitor.VisitParameter(this));
 }
 /// <summary>
 /// Accepts the visit of a SQL visitor
 /// </summary>
 /// <param name="visitor">The <see cref="SqlExpressionVisitor"/> that is visiting
 /// the expression.</param>
 /// <returns>
 /// Returns an instance of <see cref="SqlExpression"/> resulting from the visit
 /// of the given <see cref="SqlExpressionVisitor"/>.
 /// </returns>
 /// <seealso cref="SqlExpressionVisitor.Visit"/>
 public virtual SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return(visitor.Visit(this));
 }
Esempio n. 6
0
 public override SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return(visitor.VisitVariable(this));
 }
Esempio n. 7
0
 public override SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return(visitor.VisitReference(this));
 }
Esempio n. 8
0
 public virtual SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return visitor.Visit(this);
 }
 public override SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return(visitor.VisitStringMatch(this));
 }
Esempio n. 10
0
            private static JoinNode FormJoinNode(PlSqlParser.JoinClauseContext context)
            {
                JoinType joinType;
                if (context.INNER() != null) {
                    joinType = JoinType.Inner;
                } else if (context.outerJoinType() != null) {
                    if (context.outerJoinType().FULL() != null) {
                        joinType = JoinType.Full;
                    } else if (context.outerJoinType().LEFT() != null) {
                        joinType = JoinType.Left;
                    } else if (context.outerJoinType().RIGHT() != null) {
                        joinType = JoinType.Right;
                    } else {
                        throw new ParseCanceledException("Invalid outer join type");
                    }
                } else {
                    throw new ParseCanceledException("Invalid join type");
                }

                var onPart = context.joinOnPart();
                if (onPart.IsEmpty)
                    throw new ParseCanceledException("None ON expression found in JOIN clause");

                var onExp = new SqlExpressionVisitor().Visit(onPart.condition());
                var source = FormSource(context.dml_table_expression_clause());

                return new JoinNode {
                    JoinType = joinType,
                    OnExpression = onExp,
                    Source = source
                };
            }