예제 #1
0
  @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();
      if (aliasMap != null) {
        aliasMap.put(ident, ident);
      }
    }

    return false;
  }
예제 #2
0
  @Override
  public boolean visit(SQLInsertStatement x) {
    setMode(x, Mode.Insert);

    setAliasMap();

    String originalTable = getCurrentTable();

    if (x.getTableName() instanceof SQLName) {
      String ident = ((SQLName) x.getTableName()).toString();
      setCurrentTable(ident);
      x.putAttribute("_old_local_", originalTable);

      TableStat stat = getTableStat(ident);
      stat.incrementInsertCount();

      Map<String, String> aliasMap = getAliasMap();
      if (aliasMap != null) {
        if (x.getAlias() != null) {
          aliasMap.put(x.getAlias(), ident);
        }
        aliasMap.put(ident, ident);
      }
    }

    accept(x.getColumns());
    accept(x.getQuery());

    return false;
  }
예제 #3
0
  public boolean visit(SQLDeleteStatement x) {
    setAliasMap();

    setMode(x, Mode.Delete);

    String tableName = x.getTableName().toString();
    setCurrentTable(tableName);

    if (x.getAlias() != null) {
      this.aliasMap.put(x.getAlias(), tableName);
    }

    TableStat stat = getTableStat(tableName);
    stat.incrementDeleteCount();

    accept(x.getWhere());

    return false;
  }
예제 #4
0
  public boolean visit(SQLUpdateStatement x) {
    setAliasMap();

    setMode(x, Mode.Update);

    SQLName identName = x.getTableName();
    if (identName != null) {
      String ident = identName.toString();
      setCurrentTable(ident);

      TableStat stat = getTableStat(ident);
      stat.incrementUpdateCount();

      Map<String, String> aliasMap = getAliasMap();
      aliasMap.put(ident, ident);
    } else {
      x.getTableSource().accept(this);
    }

    accept(x.getItems());
    accept(x.getWhere());

    return false;
  }
예제 #5
0
 public boolean visit(SQLSelectStatement x) {
   setAliasMap();
   return true;
 }