com.alibaba.druid.sql.ast.expr.SQLBooleanExpr Java Examples
The following examples show how to use
com.alibaba.druid.sql.ast.expr.SQLBooleanExpr.
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 File: JoinParser.java From Mycat2 with GNU General Public License v3.0 | 6 votes |
private Object getExpValue(SQLExpr expr){ if (expr instanceof SQLIntegerExpr){ return ((SQLIntegerExpr)expr).getNumber().longValue(); } if (expr instanceof SQLNumberExpr){ return ((SQLNumberExpr)expr).getNumber().doubleValue(); } if (expr instanceof SQLCharExpr){ String va=((SQLCharExpr)expr).toString(); return va;//remove(va,'\''); } if (expr instanceof SQLBooleanExpr){ return ((SQLBooleanExpr)expr).getValue(); } if (expr instanceof SQLNullExpr){ return null; } return expr; }
Example #2
Source File: Maker.java From elasticsearch-sql with Apache License 2.0 | 6 votes |
private Object parseTermValue(Object termValue) { if (termValue instanceof SQLNumericLiteralExpr) { termValue = ((SQLNumericLiteralExpr) termValue).getNumber(); if (termValue instanceof BigDecimal || termValue instanceof Double) { termValue = ((Number) termValue).doubleValue(); } else if (termValue instanceof Float) { termValue = ((Number) termValue).floatValue(); } else if (termValue instanceof BigInteger || termValue instanceof Long) { termValue = ((Number) termValue).longValue(); } else if (termValue instanceof Integer) { termValue = ((Number) termValue).intValue(); } else if (termValue instanceof Short) { termValue = ((Number) termValue).shortValue(); } else if (termValue instanceof Byte) { termValue = ((Number) termValue).byteValue(); } } else if (termValue instanceof SQLBooleanExpr) { termValue = ((SQLBooleanExpr) termValue).getValue(); } else { termValue = termValue.toString(); } return termValue; }
Example #3
Source File: Util.java From elasticsearch-sql with Apache License 2.0 | 6 votes |
public static Object expr2Object(SQLExpr expr, String charWithQuote) { Object value = null; if (expr instanceof SQLNumericLiteralExpr) { value = ((SQLNumericLiteralExpr) expr).getNumber(); } else if (expr instanceof SQLCharExpr) { value = charWithQuote + ((SQLCharExpr) expr).getText() + charWithQuote; } else if (expr instanceof SQLIdentifierExpr) { value = expr.toString(); } else if (expr instanceof SQLPropertyExpr) { value = expr.toString(); } else if (expr instanceof SQLVariantRefExpr) { value = expr.toString(); } else if (expr instanceof SQLAllColumnExpr) { value = "*"; } else if (expr instanceof SQLValuableExpr) { value = ((SQLValuableExpr) expr).getValue(); } else if (expr instanceof SQLBooleanExpr) { value = ((SQLBooleanExpr) expr).getValue(); } else { //throw new SqlParseException("can not support this type " + expr.getClass()); } return value; }
Example #4
Source File: ItemFuncIstrue.java From dble with GNU General Public License v2.0 | 4 votes |
@Override public SQLExpr toExpression() { SQLExpr left = args.get(0).toExpression(); return new SQLBinaryOpExpr(left, SQLBinaryOperator.Is, new SQLBooleanExpr(true)); }
Example #5
Source File: ItemFuncIsnottrue.java From dble with GNU General Public License v2.0 | 4 votes |
@Override public SQLExpr toExpression() { SQLExpr left = args.get(0).toExpression(); return new SQLBinaryOpExpr(left, SQLBinaryOperator.IsNot, new SQLBooleanExpr(true)); }
Example #6
Source File: ItemFuncIsnotfalse.java From dble with GNU General Public License v2.0 | 4 votes |
@Override public SQLExpr toExpression() { SQLExpr left = args.get(0).toExpression(); return new SQLBinaryOpExpr(left, SQLBinaryOperator.IsNot, new SQLBooleanExpr(false)); }
Example #7
Source File: ItemFuncIsfalse.java From dble with GNU General Public License v2.0 | 4 votes |
@Override public SQLExpr toExpression() { SQLExpr left = args.get(0).toExpression(); return new SQLBinaryOpExpr(left, SQLBinaryOperator.Is, new SQLBooleanExpr(false)); }