/** * delete update 语句 where 处理 */ protected BinaryExpression andExpression(Table table, Expression where) { //获得where条件表达式 EqualsTo equalsTo = new EqualsTo(); equalsTo.setLeftExpression(this.getAliasColumn(table)); equalsTo.setRightExpression(tenantHandler.getTenantId()); if (null != where) { if (where instanceof OrExpression) { return new AndExpression(equalsTo, new Parenthesis(where)); } else { return new AndExpression(equalsTo, where); } } return equalsTo; }
/** * This helper method is used to change the multiple expression into * the binary form, respectively and return the root of the expression tree. * @param isMultiOr variable tells whether the expression is or. * @param exp the expression that needs to be converted. * @return the root of the expression tree. */ public Expression changeBack(Boolean isMultiOr, Expression exp) { if(!(exp instanceof MultipleExpression)) { return exp; } MultipleExpression changed = (MultipleExpression) exp; Expression result = changed.getChild(0); for(int i=1; i<changed.size(); i++) { Expression left = result; Expression right = changed.getChild(i); if(isMultiOr) { result = new OrExpression(left, right); } else { result = new AndExpression(left, right); } } if(isMultiOr) { return new Parenthesis(result); } return result; }
/** * 处理条件 */ protected Expression builderExpression(Expression expression, Table table) { //生成字段名 EqualsTo equalsTo = new EqualsTo(); equalsTo.setLeftExpression(this.getAliasColumn(table)); equalsTo.setRightExpression(tenantHandler.getTenantId()); //加入判断防止条件为空时生成 "and null" 导致查询结果为空 if (expression == null) { return equalsTo; } else { if (expression instanceof BinaryExpression) { BinaryExpression binaryExpression = (BinaryExpression) expression; if (binaryExpression.getLeftExpression() instanceof FromItem) { processFromItem((FromItem) binaryExpression.getLeftExpression()); } if (binaryExpression.getRightExpression() instanceof FromItem) { processFromItem((FromItem) binaryExpression.getRightExpression()); } } if (expression instanceof OrExpression) { return new AndExpression(equalsTo, new Parenthesis(expression)); } else { return new AndExpression(equalsTo, expression); } } }
final public Expression Expression() throws ParseException { Expression retval = null; if (jj_2_9(2147483647)) { retval = OrExpression(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 79: jj_consume_token(79); retval = Expression(); jj_consume_token(80); retval = new Parenthesis(retval); break; default: jj_la1[79] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if (true) return retval;} throw new Error("Missing return statement in function"); }
final public Expression SimpleExpression() throws ParseException { Expression retval = null; if (jj_2_20(2147483647)) { retval = BitwiseAndOr(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 79: jj_consume_token(79); retval = BitwiseAndOr(); jj_consume_token(80); retval = new Parenthesis(retval); break; default: jj_la1[100] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if (true) return retval;} throw new Error("Missing return statement in function"); }
leftExpression = AdditiveExpression(); jj_consume_token(80); leftExpression = new Parenthesis(leftExpression); break; default: rightExpression = AdditiveExpression(); jj_consume_token(80); rightExpression = new Parenthesis(rightExpression); break; default:
left = OrExpression(); jj_consume_token(80); left = new Parenthesis(left); if (not) { ((Parenthesis)left).setNot(); not = false; } break; default: right = OrExpression(); jj_consume_token(80); right = new Parenthesis(right); if (not) { ((Parenthesis)right).setNot(); not = false; } break; default:
left = OrExpression(); jj_consume_token(200); left = new Parenthesis(left); if (not) { ((Parenthesis)left).setNot(); not = false; } break; right = OrExpression(); jj_consume_token(200); right = new Parenthesis(right); if (not) { ((Parenthesis)right).setNot(); not = false; } break;
public void visit(Parenthesis parenthesis) { Expression pExp = parenthesis.getExpression(); Expression qualifiedExpression; qualifiedExpression = qualify(session, tableAliases, pExp); Parenthesis qualified = new Parenthesis(); qualified.setExpression(qualifiedExpression); this._qualifiedExpression = qualified; }
retval = SimpleExpression(); jj_consume_token(200); retval = new Parenthesis(retval); } else if (jj_2_84(3)) { jj_consume_token(198);
retval = PrimaryExpression(); jj_consume_token(80); retval = new Parenthesis(retval); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
public void visit(Parenthesis parenthesis) { Expression pExp = parenthesis.getExpression(); Expression qualifiedExpression; qualifiedExpression = qualify(session, tableAliases, pExp); Parenthesis qualified = new Parenthesis(); qualified.setExpression(qualifiedExpression); this._qualifiedExpression = qualified; }
/** * <p> * delete update 语句 where 处理 * </p> */ protected BinaryExpression andExpression(Table table, Expression where) { //获得where条件表达式 EqualsTo equalsTo = new EqualsTo(); equalsTo.setLeftExpression(this.getAliasColumn(table)); equalsTo.setRightExpression(tenantHandler.getTenantId()); if (null != where) { if (where instanceof OrExpression) { return new AndExpression(equalsTo, new Parenthesis(where)); } else { return new AndExpression(equalsTo, where); } } return equalsTo; }
/** * This helper method is used to change the multiple expression into * the binary form, respectively and return the root of the expression tree. * @param isMultiOr variable tells whether the expression is or. * @param exp the expression that needs to be converted. * @return the root of the expression tree. */ public Expression changeBack(Boolean isMultiOr, Expression exp) { if(!(exp instanceof MultipleExpression)) { return exp; } MultipleExpression changed = (MultipleExpression) exp; Expression result = changed.getChild(0); for(int i=1; i<changed.size(); i++) { Expression left = result; Expression right = changed.getChild(i); if(isMultiOr) { result = new OrExpression(left, right); } else { result = new AndExpression(left, right); } } if(isMultiOr) { return new Parenthesis(result); } return result; }
final public Expression Expression() throws ParseException {Expression retval = null; if (jj_2_9(2147483647)) { retval = OrExpression(); } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case 79:{ jj_consume_token(79); retval = Expression(); jj_consume_token(80); retval = new Parenthesis(retval); break; } default: jj_la1[80] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if ("" != null) return retval;} throw new Error("Missing return statement in function"); }
final public Expression SimpleExpression() throws ParseException {Expression retval = null; if (jj_2_20(2147483647)) { retval = AdditiveExpression(); } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case 79:{ jj_consume_token(79); retval = AdditiveExpression(); jj_consume_token(80); retval = new Parenthesis(retval); break; } default: jj_la1[101] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if ("" != null) return retval;} throw new Error("Missing return statement in function"); }
/** * 处理条件 */ protected Expression builderExpression(Expression expression, Table table) { //生成字段名 EqualsTo equalsTo = new EqualsTo(); equalsTo.setLeftExpression(this.getAliasColumn(table)); equalsTo.setRightExpression(tenantHandler.getTenantId()); //加入判断防止条件为空时生成 "and null" 导致查询结果为空 if (expression == null) { return equalsTo; } else { if (expression instanceof BinaryExpression) { BinaryExpression binaryExpression = (BinaryExpression) expression; if (binaryExpression.getLeftExpression() instanceof FromItem) { processFromItem((FromItem) binaryExpression.getLeftExpression()); } if (binaryExpression.getRightExpression() instanceof FromItem) { processFromItem((FromItem) binaryExpression.getRightExpression()); } } if (expression instanceof OrExpression) { return new AndExpression(equalsTo, new Parenthesis(expression)); } else { return new AndExpression(equalsTo, expression); } } }
EqualsTo condition = new EqualsTo(); parsedQuery.setWhere( new AndExpression(condition, new Parenthesis(parsedQuery.getWhere()))); net.sf.jsqlparser.schema.Column column = new net.sf.jsqlparser.schema.Column(mainEntityTable, propertyAccessor.getName());
retval = new Parenthesis(retval); ((Parenthesis) retval).setCommentBeginBracket(commentBeginBracket); if (tk.specialToken != null) {
retval = new Parenthesis(retval); ((Parenthesis) retval).setCommentBeginBracket(commentBeginBracket); {if (tk.specialToken != null) {