protected void visitBinaryExpression(BinaryExpression expr) { expr.getLeftExpression().accept(this); expr.getRightExpression().accept(this); }
@Override public void visit(PlainSelect plainSelect) { for (SelectItem item : plainSelect.getSelectItems()) { item.accept(this); } if (itemsExpr.size() > 1) { BinaryExpression binExpr = createBinaryExpression(); binExpr.setLeftExpression(itemsExpr.get(0).getExpression()); for (int i = 1; i < itemsExpr.size() - 1; i++) { binExpr.setRightExpression(itemsExpr.get(i).getExpression()); BinaryExpression binExpr2 = createBinaryExpression(); binExpr2.setLeftExpression(binExpr); binExpr = binExpr2; } binExpr.setRightExpression(itemsExpr.get(itemsExpr.size() - 1).getExpression()); SelectExpressionItem sei = new SelectExpressionItem(); sei.setExpression(binExpr); plainSelect.getSelectItems().clear(); plainSelect.getSelectItems().add(sei); } ((SelectExpressionItem) plainSelect.getSelectItems().get(0)).setAlias(new Alias(alias)); }
private void visitBinaryExpression(BinaryExpression binaryExpression, String operator) { if (binaryExpression.isNot()) { buffer.append(NOT); } binaryExpression.getLeftExpression().accept(this); buffer.append(operator); binaryExpression.getRightExpression().accept(this); }
@Override public String toString() { return (not ? "NOT " : "") + getLeftExpression() + " " + getStringExpression() + " " + getRightExpression(); }
private void visitBinaryExpression(BinaryExpression exp) { Expression left = ExpressionQualifier.qualify(session, tableAliases, exp.getLeftExpression()); Expression right = ExpressionQualifier.qualify(session, tableAliases, exp.getRightExpression()); BinaryExpression qualified; if (exp instanceof Addition) qualified = new Addition(); else if (exp instanceof Division) qualified = new Division(); else if (exp instanceof Multiplication) qualified = new Multiplication(); else if (exp instanceof Subtraction) qualified = new Subtraction(); else if (exp instanceof EqualsTo) qualified = new EqualsTo(); else if (exp instanceof GreaterThan) qualified = new GreaterThan(); else if (exp instanceof GreaterThanEquals) qualified = new GreaterThanEquals(); else if (exp instanceof LikeExpression) qualified = new LikeExpression(); else if (exp instanceof MinorThan) qualified = new MinorThan(); else if (exp instanceof MinorThanEquals) qualified = new MinorThanEquals(); else if (exp instanceof NotEqualsTo) qualified = new NotEqualsTo(); else throw new IllegalArgumentException("Unknown binary expression: " + exp); qualified.setLeftExpression(left); qualified.setRightExpression(right); this._qualifiedExpression = qualified; }
} else if (expression instanceof BinaryExpression) { BinaryExpression binaryExpression = (BinaryExpression) expression; if (binaryExpression.isNot()) { throw new MybatisPlusException("非法SQL,where条件中不能使用【not】关键字,错误not信息:" + binaryExpression.toString()); if (binaryExpression.getLeftExpression() instanceof Function) { Function function = (Function) binaryExpression.getLeftExpression(); throw new MybatisPlusException("非法SQL,where条件中不能使用数据库函数,错误函数信息:" + function.toString()); if (binaryExpression.getRightExpression() instanceof SubSelect) { SubSelect subSelect = (SubSelect) binaryExpression.getRightExpression(); throw new MybatisPlusException("非法SQL,where条件中不能使用子查询,错误子查询SQL信息:" + subSelect.toString());
@Override public String toString() { return (not ? (getCommentNot() != null ? getCommentNot() + " " : "") + "NOT " : "") + (leftPrior ? (getCommentLeftPrior() != null ? getCommentLeftPrior() + " " : "") + "PRIOR " : "") + getLeftExpression() + " " + getStringExpression() + " " + (rightPrior ? (getCommentRightPrior() != null ? getCommentRightPrior() + " " : "") + "PRIOR " : "") + getRightExpression(); }
private void visitBinaryExpression(BinaryExpression binaryExpression, String operator) { if (binaryExpression.isNot()) { buffer.append(binaryExpression.getCommentNot() != null ? " " + binaryExpression.getCommentNot() + ExpressionDeParser.LINE_SEPARATOR : "").append(" not "); } binaryExpression.getLeftExpression().accept(this); buffer.append(operator); binaryExpression.getRightExpression().accept(this); }
private void visitBinaryExpression(BinaryExpression binaryExpression) { Expression left = binaryExpression.getLeftExpression(); Expression right = binaryExpression.getRightExpression(); if (right instanceof AnyComparisonExpression){ right = new AnyComparison(((AnyComparisonExpression) right).getSubSelect()); binaryExpression.setRightExpression(right); } if (right instanceof AllComparisonExpression){ right = new AllComparison(((AllComparisonExpression) right).getSubSelect()); binaryExpression.setRightExpression(right); } left.accept(this); right.accept(this); }
regCond.setLeftExpression(leftExpression); regCond.setRightExpression(rightExpression); if (not) regCond.setNot(); {if (true) return result;} throw new Error("Missing return statement in function");
regCond.setLeftExpression(leftExpression); regCond.setLeftPrior(leftPrior); regCond.setRightExpression(rightExpression); regCond.setRightPrior(rightPrior); if (not) regCond.setNot(); regCond.setCommentNot(commentNot); regCond.setCommentLeftPrior(commentLeftPrior); regCond.setCommentRightPrior(commentRightPrior); {if ("" != null) return result;} throw new Error("Missing return statement in function");
@Override public String toString() { String retval = super.toString(); if (escape != null) { retval += " ESCAPE " + "'" + escape + "'"; } return retval; }
private void visitBinaryExpression(BinaryExpression e) { if (e.getLeftExpression() instanceof JdbcParameter) { e.setLeftExpression(ImmutableExpressionsCache.internOrFixJdbcParameterExpression((JdbcParameter) e.getLeftExpression())); } if (e.getRightExpression() instanceof JdbcParameter) { e.setRightExpression(ImmutableExpressionsCache.internOrFixJdbcParameterExpression((JdbcParameter) e.getRightExpression())); } e.getLeftExpression().accept(this); e.getRightExpression().accept(this); }
public String toString() { return (not? "NOT ":"") + getLeftExpression()+" "+getStringExpression()+" "+getRightExpression(); }
} else if (expression instanceof BinaryExpression) { BinaryExpression binaryExpression = (BinaryExpression) expression; if (binaryExpression.isNot()) { throw new MybatisPlusException("非法SQL,where条件中不能使用【not】关键字,错误not信息:" + binaryExpression.toString()); if (binaryExpression.getLeftExpression() instanceof Function) { Function function = (Function) binaryExpression.getLeftExpression(); throw new MybatisPlusException("非法SQL,where条件中不能使用数据库函数,错误函数信息:" + function.toString()); if (binaryExpression.getRightExpression() instanceof SubSelect) { SubSelect subSelect = (SubSelect) binaryExpression.getRightExpression(); throw new MybatisPlusException("非法SQL,where条件中不能使用子查询,错误子查询SQL信息:" + subSelect.toString());
regCond.setLeftExpression(leftExpression); regCond.setRightExpression(rightExpression); if (not) regCond.setNot();
public String toString() { String retval = super.toString(); if (escape != null) { retval += " ESCAPE " + "'" + escape + "'"; } return retval; }
public void visitBinaryExpression(BinaryExpression binaryExpression) { binaryExpression.getLeftExpression().accept(this); binaryExpression.getRightExpression().accept(this); }