private IASTNode CreatePredicateRightValue(MySqlCommandParser.BooleanPrimaryContext ctx, IASTNode rightValue) { if (rightValue is ColumnSegment) { return(rightValue); } return(rightValue is SubQuerySegment subQuerySegment ? new PredicateCompareRightValue(ctx.comparisonOperator().GetText(), new SubQueryExpressionSegment(subQuerySegment)) : new PredicateCompareRightValue(ctx.comparisonOperator().GetText(), (IExpressionSegment)rightValue)); }
public override IASTNode VisitBooleanPrimary(MySqlCommandParser.BooleanPrimaryContext ctx) { if (null != ctx.comparisonOperator() || null != ctx.SAFE_EQ_()) { return(CreateCompareSegment(ctx)); } if (null != ctx.predicate()) { return(Visit(ctx.predicate())); } if (null != ctx.subquery()) { return(new SubQuerySegment(ctx.Start.StartIndex, ctx.Stop.StopIndex, (SelectCommand)Visit(ctx.subquery()))); } //TODO deal with IS NOT? (TRUE | FALSE | UNKNOWN | NULL) return(new CommonExpressionSegment(ctx.Start.StartIndex, ctx.Stop.StopIndex, ctx.GetText())); }