Visit() public method

Visits a given SQL expression.
public Visit ( SqlExpression expression ) : SqlExpression
expression SqlExpression The to visit.
return SqlExpression
Example #1
0
        private static void Visit(SqlExpression exp, bool equals = false)
        {
            var visitor = new SqlExpressionVisitor();
            var result  = exp.Accept(visitor);

            Assert.IsType(exp.GetType(), result);
            Assert.Equal(equals, result.Equals(exp));

            result = visitor.Visit(exp);
            Assert.IsType(exp.GetType(), result);
            Assert.Equal(equals, result.Equals(exp));
        }
Example #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);
        }
 /// <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));
 }
Example #4
0
 public virtual SqlExpression Accept(SqlExpressionVisitor visitor)
 {
     return visitor.Visit(this);
 }