Java Code Examples for net.sf.jsqlparser.expression.operators.conditional.OrExpression
The following examples show how to use
net.sf.jsqlparser.expression.operators.conditional.OrExpression.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: openprodoc Author: JHierrot File: ObjPD.java License: GNU Affero General Public License v3.0 | 6 votes |
private int EvalExprType(Expression where) { if (where instanceof AndExpression) return (EXPR_AND); else if (where instanceof OrExpression) return (EXPR_OR); else if (where instanceof BinaryExpression) return(EXPR_BASIC); else if (where instanceof Function) return(EXPR_FUNCT); else if (where instanceof Parenthesis) return (EXPR_PAR); else if (where instanceof InExpression) return (EXPR_IN); else if (where instanceof NotExpression) return (EXPR_NOT); return(-1); }
Example #2
Source Project: nimble-orm Author: pugwoo File: FixedAndExpression.java License: GNU General Public License v2.0 | 6 votes |
@Override public String toString() { // jsqlparse 2.1+版本已移除not StringBuilder sb = new StringBuilder(/*isNot() ? "NOT " : ""*/); if(getLeftExpression() instanceof OrExpression) { sb.append("(").append(getLeftExpression()).append(")"); } else { sb.append(getLeftExpression()); } sb.append(" ").append(getStringExpression()).append(" "); if(getRightExpression() instanceof OrExpression) { sb.append("(").append(getRightExpression()).append(")"); } else { sb.append(getRightExpression()); } return sb.toString().trim().isEmpty() ? " " : "("+sb.toString()+")"; }
Example #3
Source Project: WeBASE-Front Author: WeBankFinTech File: CRUDParseUtils.java License: Apache License 2.0 | 5 votes |
private static Condition handleExpression(Condition condition, Expression expr) throws FrontException { if (expr instanceof BinaryExpression) { condition = getWhereClause((BinaryExpression) (expr), condition); } if (expr instanceof OrExpression) { throw new FrontException(PrecompiledUtils.CRUD_SQL_ERROR, "The OrExpression is not supported."); } if (expr instanceof NotExpression) { throw new FrontException(PrecompiledUtils.CRUD_SQL_ERROR, "The NotExpression is not supported."); } if (expr instanceof InExpression) { throw new FrontException(PrecompiledUtils.CRUD_SQL_ERROR, "The InExpression is not supported."); } if (expr instanceof LikeExpression) { throw new FrontException(PrecompiledUtils.CRUD_SQL_ERROR, "The LikeExpression is not supported."); } if (expr instanceof SubSelect) { throw new FrontException(PrecompiledUtils.CRUD_SQL_ERROR, "The SubSelect is not supported."); } if (expr instanceof IsNullExpression) { throw new FrontException(PrecompiledUtils.CRUD_SQL_ERROR, "The IsNullExpression is not supported."); } Map<String, Map<EnumOP, String>> conditions = condition.getConditions(); Set<String> keys = conditions.keySet(); for (String key : keys) { Map<EnumOP, String> value = conditions.get(key); EnumOP operation = value.keySet().iterator().next(); String itemValue = value.values().iterator().next(); String newValue = trimQuotes(itemValue); value.put(operation, newValue); conditions.put(key, value); } condition.setConditions(conditions); return condition; }
Example #4
Source Project: evosql Author: SERG-Delft File: QueryStripperVisitor.java License: Apache License 2.0 | 5 votes |
@Override public void visit(OrExpression arg0) { Expression e = visitExpression(arg0.getLeftExpression()); if (e != null) arg0.setLeftExpression(e); e = visitExpression(arg0.getRightExpression()); if (e != null) arg0.setRightExpression(e); }
Example #5
Source Project: sql-to-mongo-db-query-converter Author: vincentrussell File: WhereVisitorMatchAndLookupPipelineMatchBuilder.java License: Apache License 2.0 | 5 votes |
protected void visitBinaryExpression(BinaryExpression expr) { this.isBaseAliasOrValue = true; expr.getLeftExpression().accept(this); if(!this.isBaseAliasOrValue) { expr.getRightExpression().accept(this); } else { expr.getRightExpression().accept(this); if(this.isBaseAliasOrValue && !(expr instanceof AndExpression || expr instanceof OrExpression)) { this.setOrAndExpression(outputMatch,expr); } } }
Example #6
Source Project: quetzal Author: Quetzal-RDF File: CTEToNestedQueryConverter.java License: Eclipse Public License 2.0 | 5 votes |
@Override public void visit(OrExpression exp) { //visitBinary(orExpression, true); clear(); boolean prevIsTopVal = isTopLevel; boolean tmpLeftTableFound = false; boolean tmpRightTableFound = false; isTopLevel = false; exp.getLeftExpression().accept(this); // update tmp tmpLeftTableFound |= leftTableFound; tmpRightTableFound |= rightTableFound; // exp.getRightExpression().accept(this); //update tmp tmpLeftTableFound |= leftTableFound; tmpRightTableFound |= rightTableFound; // // update leftTableFound = tmpLeftTableFound; rightTableFound = tmpRightTableFound; whereOnlyExpFound = true; // isTopLevel = prevIsTopVal; defaultTopLevelProcessing(exp); }
Example #7
Source Project: DataPermissionHelper Author: holyliao File: ExpressionVisitorImpl.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression orExpression) { visitBinaryExpression(orExpression); }
Example #8
Source Project: spanner-jdbc Author: olavloite File: DMLWhereClauseVisitorAdapter.java License: MIT License | 4 votes |
@Override public void visit(OrExpression expr) { invalid = true; super.visit(expr); }
Example #9
Source Project: jobson Author: adamkewley File: AllColumnRefsFinder.java License: Apache License 2.0 | 4 votes |
public void visit(OrExpression orExpression) { orExpression.getLeftExpression().accept(this); orExpression.getRightExpression().accept(this); }
Example #10
Source Project: evosql Author: SERG-Delft File: SeedVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression arg0) { arg0.getLeftExpression().accept(this); arg0.getRightExpression().accept(this); }
Example #11
Source Project: evosql Author: SERG-Delft File: UsedColumnExtractorVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression arg0) { arg0.getLeftExpression().accept(this); arg0.getRightExpression().accept(this); }
Example #12
Source Project: evosql Author: SERG-Delft File: TablesNamesFinder.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression orExpression) { visitBinaryExpression(orExpression); }
Example #13
Source Project: evosql Author: SERG-Delft File: ClassifierVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression arg0) { arg0.getLeftExpression().accept(this); arg0.getRightExpression().accept(this); }
Example #14
Source Project: evosql Author: SERG-Delft File: DetailedClassifierVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression arg0) { arg0.getLeftExpression().accept(this); arg0.getRightExpression().accept(this); }
Example #15
Source Project: evosql Author: SERG-Delft File: FunctionClassifierVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression arg0) { arg0.getLeftExpression().accept(this); arg0.getRightExpression().accept(this); }
Example #16
Source Project: evosql Author: SERG-Delft File: CryptoVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression arg0) { arg0.getLeftExpression().accept(this); arg0.getRightExpression().accept(this); }
Example #17
Source Project: sql-to-mongo-db-query-converter Author: vincentrussell File: WhereCauseProcessor.java License: Apache License 2.0 | 4 votes |
private boolean isOrAndExpression(Expression expression) { return OrExpression.class.isInstance(expression) || AndExpression.class.isInstance(expression); }
Example #18
Source Project: sql-to-mongo-db-query-converter Author: vincentrussell File: WhereVisitorMatchAndLookupPipelineMatchBuilder.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression expr) { this.haveOrExpression.setValue(true); }
Example #19
Source Project: compass Author: sogou-biztech File: TableRenameVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression orExpression) { visitBinaryExpression(orExpression); }
Example #20
Source Project: cassandra-jdbc-driver Author: zhicwu File: SqlToCqlTranslator.java License: Apache License 2.0 | 4 votes |
public void visit(OrExpression orExpression) { throw new UnsupportedOperationException("Not supported yet."); }
Example #21
Source Project: openprodoc Author: JHierrot File: ObjPD.java License: GNU Affero General Public License v3.0 | 4 votes |
private Conditions EvalExpr(Expression ParentExpr ) throws PDException { Conditions New = new Conditions(); int ExprType= EvalExprType(ParentExpr); //System.out.println("ParentExpr=["+ParentExpr+"] Type="+ExprType); switch (ExprType) { case EXPR_BASIC: ComparisonOperator CO = (ComparisonOperator) ParentExpr; String Left=CO.getLeftExpression().toString(); String Comp=CO.getStringExpression(); String Right=CO.getRightExpression().toString(); if (isField(Left) && isField(Right)) New.addCondition(new Condition(Left, Right)); else { String FieldName; Object Value; int TypeVal; if (isField(Left)) { FieldName=Left; Value=CalcVal(Right); TypeVal=CalcTypeVal(Right); } else { FieldName=Right; Value=CalcVal(Left); TypeVal=CalcTypeVal(Left); } // System.out.println("Value="+Value+" class="+Value.getClass().getName()); New.addCondition(new Condition(FieldName, getCompConv().get(Comp), Value, TypeVal)); } break; case EXPR_NOT: Conditions Cs=EvalExpr(((NotExpression) ParentExpr).getExpression()); Cs.setInvert(true); New.addCondition(Cs); break; case EXPR_AND: New.addCondition(EvalExpr(((AndExpression) ParentExpr).getLeftExpression() )); New.addCondition(EvalExpr(((AndExpression) ParentExpr).getRightExpression() )); break; case EXPR_OR: New.addCondition(EvalExpr(((OrExpression) ParentExpr).getLeftExpression() )); New.addCondition(EvalExpr(((OrExpression) ParentExpr).getRightExpression() )); New.setOperatorAnd(false); break; case EXPR_PAR: New.addCondition(EvalExpr(((Parenthesis) ParentExpr).getExpression() )); break; case EXPR_IN: String FieldNameIn=((InExpression)ParentExpr).getLeftExpression().toString(); HashSet<String> ListTerms = new HashSet<String>(); List<Expression> LT =((ExpressionList)((InExpression)ParentExpr).getLeftItemsList()).getExpressions(); for (Iterator<Expression> iterator = LT.iterator(); iterator.hasNext();) { StringValue NextTerm = (StringValue)iterator.next(); ListTerms.add(NextTerm.getValue()); } New.addCondition(new Condition(FieldNameIn,ListTerms)); break; case EXPR_FUNCT: String Arg=((Function)ParentExpr).getParameters().getExpressions().get(0).toString(); switch (((Function)ParentExpr).getName()) { case Condition.CONTAINS: New.addCondition(Condition.genContainsCond(PDDocs.getTableName(),Arg, getDrv())); break; case Condition.INTREE: New.addCondition(Condition.genInTreeCond( Arg, getDrv())); break; case Condition.INFOLDER: New.addCondition(Condition.genInFolder(Arg, getDrv())); break; } break; } return(New); }
Example #22
Source Project: DDF Author: ddf-project File: TableVisitor.java License: Apache License 2.0 | 4 votes |
public void visit(OrExpression orExpression) throws Exception { visitBinaryExpression(orExpression); }
Example #23
Source Project: foxtrot Author: Flipkart File: SqlElementVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visit(OrExpression orExpression) { //supported construct }