Ejemplo n.º 1
0
  // DUAL
  public boolean visit(MySqlDeleteStatement x) {
    setAliasMap();

    setMode(x, Mode.Delete);

    accept(x.getFrom());
    accept(x.getUsing());
    x.getTableSource().accept(this);

    if (x.getTableSource() instanceof SQLExprTableSource) {
      SQLName tableName = (SQLName) ((SQLExprTableSource) x.getTableSource()).getExpr();
      String ident = tableName.toString();
      setCurrentTable(x, ident);

      TableStat stat = this.getTableStat(ident);
      stat.incrementDeleteCount();
    }

    accept(x.getWhere());

    accept(x.getOrderBy());
    accept(x.getLimit());

    return false;
  }
Ejemplo n.º 2
0
  @Override
  public boolean visit(MySqlDeleteStatement x) {
    print("DELETE ");

    if (x.isLowPriority()) {
      print("LOW_PRIORITY ");
    }

    if (x.isQuick()) {
      print("QUICK ");
    }

    if (x.isIgnore()) {
      print("IGNORE ");
    }

    if (x.getFrom() == null) {
      print("FROM ");
      printAndAccept(x.getTableNames(), ", ");
    } else {
      printAndAccept(x.getTableNames(), ", ");
      println();
      print("FROM ");
      x.getFrom().accept(this);
    }

    if (x.getUsing() != null) {
      println();
      print("USING ");
      x.getUsing().accept(this);
    }

    if (x.getWhere() != null) {
      println();
      print("WHERE ");
      x.getWhere().accept(this);
    }

    if (x.getOrderBy() != null) {
      println();
      x.getOrderBy().accept(this);
    }

    if (x.getLimit() != null) {
      println();
      x.getLimit().accept(this);
    }

    return false;
  }