mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for SchemaStatVisitor.
This commit is contained in:
+13
-6
@@ -78,14 +78,21 @@ public class MySqlSchemaStatVisitor extends SchemaStatVisitor implements MySqlAS
|
||||
repository.resolve(x);
|
||||
}
|
||||
|
||||
setMode(x, Mode.Delete);
|
||||
SQLTableSource from = x.getFrom();
|
||||
if (from != null) {
|
||||
from.accept(this);
|
||||
}
|
||||
|
||||
accept(x.getFrom());
|
||||
accept(x.getUsing());
|
||||
x.getTableSource().accept(this);
|
||||
SQLTableSource using = x.getUsing();
|
||||
if (using != null) {
|
||||
using.accept(this);
|
||||
}
|
||||
|
||||
if (x.getTableSource() instanceof SQLExprTableSource) {
|
||||
TableStat stat = this.getTableStat(x.getExprTableSource());
|
||||
SQLTableSource tableSource = x.getTableSource();
|
||||
tableSource.accept(this);
|
||||
|
||||
if (tableSource instanceof SQLExprTableSource) {
|
||||
TableStat stat = this.getTableStat((SQLExprTableSource) tableSource);
|
||||
stat.incrementDeleteCount();
|
||||
}
|
||||
|
||||
|
||||
@@ -1693,6 +1693,17 @@ class SchemaResolveVisitorFactory {
|
||||
}
|
||||
|
||||
if (table != null) {
|
||||
if (from != null && table instanceof SQLExprTableSource) {
|
||||
SQLExpr tableExpr = ((SQLExprTableSource) table).getExpr();
|
||||
if (tableExpr instanceof SQLPropertyExpr
|
||||
&& ((SQLPropertyExpr) tableExpr).getName().equals("*")) {
|
||||
String alias = ((SQLPropertyExpr) tableExpr).getOwnernName();
|
||||
SQLTableSource refTableSource = from.findTableSource(alias);
|
||||
if (refTableSource != null) {
|
||||
((SQLPropertyExpr) tableExpr).setResolvedTableSource(refTableSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
table.accept(visitor);
|
||||
ctx.setTableSource(table);
|
||||
}
|
||||
|
||||
@@ -1764,13 +1764,6 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void endVisit(SQLDeleteStatement x) {
|
||||
|
||||
}
|
||||
|
||||
public void endVisit(SQLUpdateStatement x) {
|
||||
}
|
||||
|
||||
public boolean visit(SQLCreateTableStatement x) {
|
||||
if (repository != null
|
||||
&& x.getParent() == null) {
|
||||
|
||||
Reference in New Issue
Block a user