@Override public boolean visit(SQLTruncateStatement x) { print("TRUNCATE TABLE "); if (x.isOnly()) { print("ONLY "); } printlnAndAccept(x.getTableSources(), ", "); if (x.getRestartIdentity() != null) { if (x.getRestartIdentity().booleanValue()) { print(" RESTART IDENTITY"); } else { print(" CONTINUE IDENTITY"); } } if (x.getCascade() != null) { if (x.getCascade().booleanValue()) { print(" CASCADE"); } else { print(" RESTRICT"); } } return false; }
@Override public boolean visit(SQLTruncateStatement x) { setMode(x, Mode.Delete); 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.incrementDeleteCount(); Map<String, String> aliasMap = getAliasMap(); if (aliasMap != null) { aliasMap.put(ident, ident); } } return false; }