mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
calculate LessThanOrGreater operator in SQLEvalVisitorUtils
This commit is contained in:
@@ -921,6 +921,7 @@ public class SQLEvalVisitorUtils {
|
||||
x.putAttribute(EVAL_VALUE, Boolean.TRUE);
|
||||
return false;
|
||||
case NotEqual:
|
||||
case LessThanOrGreater:
|
||||
case NotLike:
|
||||
case GreaterThan:
|
||||
case LessThan:
|
||||
@@ -1011,6 +1012,7 @@ public class SQLEvalVisitorUtils {
|
||||
x.putAttribute(EVAL_VALUE, value);
|
||||
break;
|
||||
case NotEqual:
|
||||
case LessThanOrGreater:
|
||||
value = !eq(leftValue, rightValue);
|
||||
x.putAttribute(EVAL_VALUE, value);
|
||||
break;
|
||||
|
||||
@@ -177,4 +177,9 @@ public class SQLEvalVisitorUtilsTest extends TestCase {
|
||||
Assert.assertEquals(4L, SQLEvalVisitorUtils.eval(JdbcUtils.MYSQL, new SQLBinaryExpr("100"), new ArrayList<Object>()));
|
||||
Assert.assertEquals(new BigInteger("36893488147419103231"), SQLEvalVisitorUtils.eval(JdbcUtils.MYSQL, new SQLBinaryExpr("11111111111111111111111111111111111111111111111111111111111111111"), new ArrayList<Object>()));
|
||||
}
|
||||
|
||||
public void test_LessThanOrGreater() throws Exception {
|
||||
Assert.assertEquals(false, SQLEvalVisitorUtils.evalExpr(JdbcUtils.MYSQL, "1<>1"));
|
||||
Assert.assertEquals(false, SQLEvalVisitorUtils.evalExpr(JdbcUtils.MYSQL, "?<>?", Arrays.<Object>asList(1, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user