public SQLStatement parseTruncate() {
accept(Token.TRUNCATE);
if (lexer.token() == Token.TABLE) {
lexer.nextToken();
}
SQLTruncateStatement stmt = new SQLTruncateStatement();
if (lexer.token() == Token.ONLY) {
lexer.nextToken();
stmt.setOnly(true);
}
for (;;) {
SQLName name = this.exprParser.name();
stmt.addTableSource(name);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
for (;;) {
if (lexer.token() == Token.PURGE) {
lexer.nextToken();
if (identifierEquals("SNAPSHOT")) {
lexer.nextToken();
acceptIdentifier("LOG");
stmt.setPurgeSnapshotLog(true);
} else {
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
continue;
}
if (lexer.token() == Token.RESTART) {
lexer.nextToken();
accept(Token.IDENTITY);
stmt.setRestartIdentity(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.SHARE) {
lexer.nextToken();
accept(Token.IDENTITY);
stmt.setRestartIdentity(Boolean.FALSE);
continue;
}
if (lexer.token() == Token.CASCADE) {
lexer.nextToken();
stmt.setCascade(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.RESTRICT) {
lexer.nextToken();
stmt.setCascade(Boolean.FALSE);
continue;
}
break;
}