mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for schema stat. for issue #2319
This commit is contained in:
@@ -256,13 +256,35 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (tableSource instanceof SQLWithSubqueryClause.Entry
|
||||
|| tableSource instanceof SQLSubqueryTableSource) {
|
||||
SQLTableSource xx = tableSource.findTableSourceWithColumn(x.nameHashCode64());
|
||||
if (xx != null) {
|
||||
} else if (tableSource instanceof SQLWithSubqueryClause.Entry) {
|
||||
return false;
|
||||
} else if (tableSource instanceof SQLSubqueryTableSource) {
|
||||
SQLSelectQueryBlock queryBlock = ((SQLSubqueryTableSource) tableSource).getSelect().getQueryBlock();
|
||||
if (queryBlock == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SQLSelectItem selectItem = queryBlock.findSelectItem(x.nameHashCode64());
|
||||
if (selectItem == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SQLExpr selectItemExpr = selectItem.getExpr();
|
||||
SQLTableSource columnTableSource = null;
|
||||
if (selectItemExpr instanceof SQLIdentifierExpr) {
|
||||
columnTableSource = ((SQLIdentifierExpr) selectItemExpr).getResolvedTableSource();
|
||||
} else if (selectItemExpr instanceof SQLPropertyExpr) {
|
||||
columnTableSource = ((SQLPropertyExpr) selectItemExpr).getResolvedTableSource();
|
||||
}
|
||||
|
||||
if (columnTableSource instanceof SQLExprTableSource && ((SQLExprTableSource) columnTableSource).getExpr() instanceof SQLName) {
|
||||
SQLName tableExpr = (SQLName) ((SQLExprTableSource) columnTableSource).getExpr();
|
||||
if (tableExpr instanceof SQLIdentifierExpr) {
|
||||
tableName = ((SQLIdentifierExpr) tableExpr).normalizedName();
|
||||
} else if (tableExpr instanceof SQLPropertyExpr) {
|
||||
tableName = ((SQLPropertyExpr) tableExpr).normalizedName();
|
||||
}
|
||||
}
|
||||
// skip
|
||||
} else {
|
||||
boolean skip = false;
|
||||
for (SQLObject parent = x.getParent();parent != null;parent = parent.getParent()) {
|
||||
|
||||
Reference in New Issue
Block a user