mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve sqlwall
This commit is contained in:
@@ -2182,16 +2182,25 @@ public class WallVisitorUtils {
|
||||
if (query instanceof SQLSelectQueryBlock) {
|
||||
SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) query;
|
||||
SQLTableSource from = queryBlock.getFrom();
|
||||
|
||||
if (queryBlock.getSelectList().size() < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from == null) {
|
||||
boolean itemIsConst = true;
|
||||
boolean itemHasAlias = false;
|
||||
for (SQLSelectItem item : queryBlock.getSelectList()) {
|
||||
if (item.getExpr() instanceof SQLIdentifierExpr || item.getExpr() instanceof SQLPropertyExpr) {
|
||||
itemIsConst = false;
|
||||
break;
|
||||
}
|
||||
if(item.getAlias() != null ) {
|
||||
itemHasAlias = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (itemIsConst) {
|
||||
if (itemIsConst && !itemHasAlias) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user