mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved SchemaStatVisitor.
This commit is contained in:
+30
-1
@@ -365,8 +365,37 @@ public class MySqlSchemaStatVisitor extends SchemaStatVisitor implements MySqlAS
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlReplaceStatement x) {
|
||||
setMode(x, Mode.Replace);
|
||||
|
||||
return true;
|
||||
setAliasMap();
|
||||
|
||||
SQLName tableName = x.getTableName();
|
||||
|
||||
String ident = null;
|
||||
if (tableName instanceof SQLIdentifierExpr) {
|
||||
ident = ((SQLIdentifierExpr) tableName).getName();
|
||||
} else if (tableName instanceof SQLPropertyExpr) {
|
||||
SQLPropertyExpr propertyExpr = (SQLPropertyExpr) tableName;
|
||||
if (propertyExpr.getOwner() instanceof SQLIdentifierExpr) {
|
||||
ident = propertyExpr.toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (ident != null) {
|
||||
setCurrentTable(x, ident);
|
||||
|
||||
TableStat stat = getTableStat(ident);
|
||||
stat.incrementInsertCount();
|
||||
|
||||
Map<String, String> aliasMap = getAliasMap();
|
||||
putAliasMap(aliasMap, ident, ident);
|
||||
}
|
||||
|
||||
accept(x.getColumns());
|
||||
accept(x.getValuesList());
|
||||
accept(x.getQuery());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user