Examples of SQLBinaryOpExpr


Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

   */
  public static void parse(SQLExpr where,
      LinkedHashMap<String, Condition> conditions, LinkedHashMap<String, Condition> ranges)
      throws UnsupportedException {
    if (where instanceof SQLBinaryOpExpr) {
      SQLBinaryOpExpr binaryOpExpr = (SQLBinaryOpExpr) where;
      SQLBinaryOperator operator = binaryOpExpr.getOperator();
      if (operator == Equality) {// one pair
        SQLIdentifierExpr left = (SQLIdentifierExpr) binaryOpExpr.getLeft();
        Condition value = new Condition(left.getName(),
            Condition.ConditionType.EQUAL, binaryOpExpr.getRight());
        conditions.put(value.getFieldName(), value);
      } else if (operator == SQLBinaryOperator.BooleanAnd) {// multi pair
        SQLExpr left = binaryOpExpr.getLeft();
        SQLExpr right = binaryOpExpr.getRight();
        parse(left, conditions, ranges);
        parse(right, conditions, ranges);
      } else if (operator == SQLBinaryOperator.GreaterThan
          || operator == SQLBinaryOperator.GreaterThanOrEqual
          || operator == SQLBinaryOperator.LessThan
          || operator == SQLBinaryOperator.LessThanOrEqual) {
        SQLIdentifierExpr left = (SQLIdentifierExpr) binaryOpExpr.getLeft();
        String fieldName = left.getName();
        Condition value = getCondition(fieldName, ranges);
        if (value == null) {
          value = new Condition(left.getName(), Condition.ConditionType.RANGE,
              binaryOpExpr.getRight(), operator);
          ranges.put(value.getFieldName(), value);
        } else {
          value.resetValue(binaryOpExpr.getRight(), operator);
        }
      } else {
        throw new UnsupportedException("where clause '" + where + " has '"
            + operator + "' , current this is Unsupported");
      }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

            lexer.nextToken();
            SQLExpr rightExp = equality();

            rightExp = relationalRest(rightExp);

            return new SQLBinaryOpExpr(expr, SQLBinaryOperator.RegExp, rightExp);
        }
       
        if (identifierEquals("RLIKE")) {
            lexer.nextToken();
            SQLExpr rightExp = equality();

            rightExp = relationalRest(rightExp);

            return new SQLBinaryOpExpr(expr, SQLBinaryOperator.RegExp, rightExp);
        }

        return super.relationalRest(expr);
    }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

            lexer.nextToken();
            SQLExpr rightExp = primary();

            rightExp = relationalRest(rightExp);

            return new SQLBinaryOpExpr(expr, SQLBinaryOperator.Modulus, rightExp);
        }

        return super.multiplicativeRest(expr);
    }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

            lexer.nextToken();
            SQLExpr rightExp = primary();

            rightExp = relationalRest(rightExp);

            return new SQLBinaryOpExpr(expr, SQLBinaryOperator.NotRegExp, rightExp);
        }
       
        if (identifierEquals("RLIKE")) {
            lexer.nextToken();
            SQLExpr rightExp = primary();

            rightExp = relationalRest(rightExp);

            return new SQLBinaryOpExpr(expr, SQLBinaryOperator.NotRLike, rightExp);
        }

        return super.notRationalRest(expr);
    }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

                }

                String collate = lexer.stringVal();
                lexer.nextToken();

                SQLBinaryOpExpr binaryExpr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.COLLATE,
                                                                 new SQLIdentifierExpr(collate));

                expr = binaryExpr;

                return primaryRest(expr);
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

        for (;;) {
            if (lexer.token() == Token.OR || lexer.token() == Token.BARBAR) {
                lexer.nextToken();
                SQLExpr rightExp = and();

                expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.BooleanOr, rightExp);
            } else if (lexer.token() == Token.XOR) {
                lexer.nextToken();
                SQLExpr rightExp = and();

                expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.BooleanXor, rightExp);
            } else {
                break;
            }
        }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

        if (where != null) {
            checkCondition(visitor, x.getWhere());

            if (Boolean.TRUE == getValue(where)) {
                if (where instanceof SQLBinaryOpExpr) {
                    SQLBinaryOpExpr binaryOpExpr = (SQLBinaryOpExpr) where;
                    if (binaryOpExpr.getOperator() == SQLBinaryOperator.Equality
                        || binaryOpExpr.getOperator() == SQLBinaryOperator.NotEqual) {
                        if (binaryOpExpr.getLeft() instanceof SQLIntegerExpr
                            && binaryOpExpr.getRight() instanceof SQLIntegerExpr) {
                            return;
                        }
                    }
                }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

                } else {
                    accept(Token.TIMESTAMP);
                    clause.setType(AsOfFlashbackQueryClause.Type.TIMESTAMP);
                }

                SQLBinaryOpExpr binaryExpr = (SQLBinaryOpExpr) createExprParser().expr();
                if (binaryExpr.getOperator() != SQLBinaryOperator.BooleanAnd) {
                    throw new SQLParseException("syntax error : " + binaryExpr.getOperator());
                }

                clause.setBegin(binaryExpr.getLeft());
                clause.setEnd(binaryExpr.getRight());

                tableReference.setFlashback(clause);
            } else {
                throw new SQLParseException("TODO");
            }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

            lexer.nextToken();
           
            if (lexer.token() == Token.NOT) {
                lexer.nextToken();
                SQLExpr rightExpr = primary();
                expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.IsNot, rightExpr);
            } else if (identifierEquals("A")) {
                lexer.nextToken();
                accept(Token.SET);
                expr = new OracleIsSetExpr(expr);
            } else {
                SQLExpr rightExpr = primary();
                expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.Is, rightExpr);
            }
           
            return expr;
        }
        return super.relationalRest(expr);
View Full Code Here

Examples of com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr

           
            rightExp = shift();

            rightExp = equalityRest(rightExp);

            expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.Equality, rightExp);
        } else if (lexer.token() == Token.BANGEQ) {
            lexer.nextToken();
            rightExp = shift();

            rightExp = equalityRest(rightExp);

            expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.NotEqual, rightExp);
        }

        return expr;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.