use of com.alibaba.druid.sql.ast.expr.SQLNumericLiteralExpr in project druid by alibaba.
the class WallVisitorUtils method eval.
public static Object eval(WallVisitor wallVisitor, String dbType, SQLObject sqlObject, List<Object> parameters) {
SQLEvalVisitor visitor = SQLEvalVisitorUtils.createEvalVisitor(dbType);
visitor.setParameters(parameters);
visitor.registerFunction("rand", Nil.instance);
visitor.registerFunction("sin", Nil.instance);
visitor.registerFunction("cos", Nil.instance);
visitor.registerFunction("asin", Nil.instance);
visitor.registerFunction("acos", Nil.instance);
sqlObject.accept(visitor);
if (sqlObject instanceof SQLNumericLiteralExpr) {
return ((SQLNumericLiteralExpr) sqlObject).getNumber();
}
return getValueFromAttributes(wallVisitor, sqlObject);
}
Aggregations