return stmt;
}
public PGDeleteStatement parseDeleteStatement() throws ParserException {
lexer.nextToken();
PGDeleteStatement deleteStatement = new PGDeleteStatement();
if (lexer.token() == (Token.FROM)) {
lexer.nextToken();
}
if (lexer.token() == (Token.ONLY)) {
lexer.nextToken();
deleteStatement.setOnly(true);
}
SQLName tableName = exprParser.name();
deleteStatement.setTableName(tableName);
if (lexer.token() == Token.USING) {
lexer.nextToken();
for (;;) {
SQLName name = this.createExprParser().name();
deleteStatement.getUsing().add(name);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
}
if (lexer.token() == (Token.WHERE)) {
lexer.nextToken();
if (lexer.token() == Token.CURRENT) {
lexer.nextToken();
accept(Token.OF);
SQLName cursorName = this.exprParser.name();
SQLExpr where = new SQLCurrentOfCursorExpr(cursorName);
deleteStatement.setWhere(where);
} else {
SQLExpr where = this.exprParser.expr();
deleteStatement.setWhere(where);
}
}
if (lexer.token() == Token.RETURNING) {
lexer.nextToken();
accept(Token.STAR);
deleteStatement.setReturning(true);
}
return deleteStatement;
}