mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for sql parser
This commit is contained in:
+6
-29
@@ -97,11 +97,7 @@ public class PGSchemaStatVisitor extends SchemaStatVisitor implements PGASTVisit
|
||||
public boolean visit(IntoClause x) {
|
||||
String ident = x.getTable().toString();
|
||||
|
||||
TableStat stat = tableStats.get(ident);
|
||||
if (stat == null) {
|
||||
stat = new TableStat();
|
||||
tableStats.put(new TableStat.Name(ident), stat);
|
||||
}
|
||||
TableStat stat = getTableStat(ident);
|
||||
stat.incrementInsertCount();
|
||||
return false;
|
||||
}
|
||||
@@ -133,11 +129,7 @@ public class PGSchemaStatVisitor extends SchemaStatVisitor implements PGASTVisit
|
||||
for (SQLName name : x.getUsing()) {
|
||||
String ident = name.toString();
|
||||
|
||||
TableStat stat = tableStats.get(ident);
|
||||
if (stat == null) {
|
||||
stat = new TableStat();
|
||||
tableStats.put(new TableStat.Name(ident), stat);
|
||||
}
|
||||
TableStat stat = getTableStat(ident);
|
||||
stat.incrementSelectCount();
|
||||
|
||||
Map<String, String> aliasMap = getAliasMap();
|
||||
@@ -152,14 +144,7 @@ public class PGSchemaStatVisitor extends SchemaStatVisitor implements PGASTVisit
|
||||
String ident = ((SQLIdentifierExpr) x.getTableName()).getName();
|
||||
setCurrentTable(ident);
|
||||
|
||||
TableStat stat = tableStats.get(ident);
|
||||
if (stat == null) {
|
||||
stat = new TableStat();
|
||||
tableStats.put(new TableStat.Name(ident), stat);
|
||||
if (x.getAlias() != null) {
|
||||
tableStats.put(new TableStat.Name(x.getAlias()), stat);
|
||||
}
|
||||
}
|
||||
TableStat stat = getTableStat(ident, x.getAlias());
|
||||
stat.incrementDeleteCount();
|
||||
|
||||
accept(x.getWhere());
|
||||
@@ -193,18 +178,14 @@ public class PGSchemaStatVisitor extends SchemaStatVisitor implements PGASTVisit
|
||||
x.putAttribute("_original_use_mode", getMode());
|
||||
setMode(x, Mode.Insert);
|
||||
|
||||
String originalTable = currentTableLocal.get();
|
||||
String originalTable = getCurrentTable();
|
||||
|
||||
if (x.getTableName() instanceof SQLName) {
|
||||
String ident = ((SQLName) x.getTableName()).toString();
|
||||
setCurrentTable(ident);
|
||||
x.putAttribute("_old_local_", originalTable);
|
||||
|
||||
TableStat stat = tableStats.get(ident);
|
||||
if (stat == null) {
|
||||
stat = new TableStat();
|
||||
tableStats.put(new TableStat.Name(ident), stat);
|
||||
}
|
||||
TableStat stat = getTableStat(ident);
|
||||
stat.incrementInsertCount();
|
||||
|
||||
Map<String, String> aliasMap = getAliasMap();
|
||||
@@ -254,11 +235,7 @@ public class PGSchemaStatVisitor extends SchemaStatVisitor implements PGASTVisit
|
||||
String ident = x.getTableName().toString();
|
||||
setCurrentTable(ident);
|
||||
|
||||
TableStat stat = tableStats.get(ident);
|
||||
if (stat == null) {
|
||||
stat = new TableStat();
|
||||
tableStats.put(new TableStat.Name(ident), stat);
|
||||
}
|
||||
TableStat stat = getTableStat(ident);
|
||||
stat.incrementUpdateCount();
|
||||
|
||||
Map<String, String> aliasMap = getAliasMap();
|
||||
|
||||
Reference in New Issue
Block a user