use of com.alibaba.druid.stat.TableStat in project druid by alibaba.
the class SQLServerSchemaStatVisitor method visit.
@Override
public boolean visit(SQLServerUpdateStatement x) {
setAliasMap();
String ident = x.getTableName().toString();
setCurrentTable(ident);
TableStat stat = getTableStat(ident);
stat.incrementUpdateCount();
Map<String, String> aliasMap = getAliasMap();
aliasMap.put(ident, ident);
accept(x.getItems());
accept(x.getFrom());
accept(x.getWhere());
return false;
}
use of com.alibaba.druid.stat.TableStat in project druid by alibaba.
the class SchemaStatVisitor method visit.
@Override
public boolean visit(SQLAlterTableDropPrimaryKey x) {
SQLAlterTableStatement stmt = (SQLAlterTableStatement) x.getParent();
String tableName = stmt.getName().toString();
TableStat tableStat = this.getTableStat(tableName);
tableStat.incrementDropIndexCount();
return false;
}
use of com.alibaba.druid.stat.TableStat in project druid by alibaba.
the class SchemaStatVisitor method visit.
@Override
public boolean visit(SQLDropTableStatement x) {
setMode(x, Mode.Insert);
setAliasMap();
String originalTable = getCurrentTable();
for (SQLExprTableSource tableSource : x.getTableSources()) {
SQLName name = (SQLName) tableSource.getExpr();
String ident = name.toString();
setCurrentTable(ident);
x.putAttribute("_old_local_", originalTable);
TableStat stat = getTableStat(ident);
stat.incrementDropCount();
Map<String, String> aliasMap = getAliasMap();
putAliasMap(aliasMap, ident, ident);
}
return false;
}
use of com.alibaba.druid.stat.TableStat in project druid by alibaba.
the class SchemaStatVisitor method visit.
@Override
public boolean visit(SQLAlterTableAddConstraint x) {
SQLConstraint constraint = x.getConstraint();
if (constraint instanceof SQLUniqueConstraint) {
SQLAlterTableStatement stmt = (SQLAlterTableStatement) x.getParent();
String tableName = stmt.getName().toString();
TableStat tableStat = this.getTableStat(tableName);
tableStat.incrementCreateIndexCount();
}
return true;
}
use of com.alibaba.druid.stat.TableStat in project druid by alibaba.
the class PGSchemaStatVisitor method visit.
@Override
public boolean visit(PGDeleteStatement x) {
if (x.getWith() != null) {
x.getWith().accept(this);
}
setAliasMap();
for (SQLName name : x.getUsing()) {
String ident = name.toString();
TableStat stat = getTableStat(ident);
stat.incrementSelectCount();
Map<String, String> aliasMap = getAliasMap();
if (aliasMap != null) {
aliasMap.put(ident, ident);
}
}
x.putAttribute("_original_use_mode", getMode());
setMode(x, Mode.Delete);
String ident = ((SQLIdentifierExpr) x.getTableName()).getName();
setCurrentTable(ident);
TableStat stat = getTableStat(ident, x.getAlias());
stat.incrementDeleteCount();
accept(x.getWhere());
return false;
}
Aggregations