mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved SchemaStatVisitor, fix #3993
This commit is contained in:
@@ -766,6 +766,22 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
|
||||
protected void handleCondition(SQLExpr expr, String operator, SQLExpr... valueExprs) {
|
||||
if (expr instanceof SQLCastExpr) {
|
||||
expr = ((SQLCastExpr) expr).getExpr();
|
||||
} else if (expr instanceof SQLMethodInvokeExpr) {
|
||||
SQLMethodInvokeExpr func = (SQLMethodInvokeExpr) expr;
|
||||
List<SQLExpr> arguments = func.getArguments();
|
||||
if (func.methodNameHashCode64() == FnvHash.Constants.COALESCE
|
||||
&& arguments.size() > 0) {
|
||||
boolean allLiteral = true;
|
||||
for (int i = 1; i < arguments.size(); ++i) {
|
||||
SQLExpr arg = arguments.get(i);
|
||||
if (!(arg instanceof SQLLiteralExpr)) {
|
||||
allLiteral = false;
|
||||
}
|
||||
}
|
||||
if (allLiteral) {
|
||||
expr = arguments.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column column = getColumn(expr);
|
||||
|
||||
Reference in New Issue
Block a user