druid SQLEvalVisitorUtils.evalExpr could not support not operator. V1.1.21

xxls0lw8  于 2022-11-02  发布在  Druid
关注(0)|答案(1)|浏览(189)

I run the method below:

SQLEvalVisitorUtils.evalExpr(JdbcConstants.H2, "? = 'druid' and not (? = '5' or ? = '3')", "druid", "5","0")

it throws Exception:

Exception in thread "main" com.alibaba.druid.DruidRuntimeException: eval error : ? = 'druid' AND NOT (? = '5' OR ? = '3') at com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils.eval(SQLEvalVisitorUtils.java:154) at com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils.eval(SQLEvalVisitorUtils.java:137) at com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils.eval(SQLEvalVisitorUtils.java:119) at com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils.evalExpr(SQLEvalVisitorUtils.java:110) at com.webank.ims.seckill.SqlParseDemo.main(SqlParseDemo.java:76)

Then, i use ! instead of not. it works :

SQLEvalVisitorUtils.evalExpr(JdbcConstants.H2, "? = 'druid' and ! (? = '5' or ? = '3')", "druid", "5","0")

hope to fix the bug. :-)

相关问题