use of com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGUpdateStatement in project druid by alibaba.
the class PGSQLStatementParser method parseUpdateStatement.
public SQLUpdateStatement parseUpdateStatement() {
accept(Token.UPDATE);
PGUpdateStatement udpateStatement = new PGUpdateStatement();
SQLSelectParser selectParser = this.exprParser.createSelectParser();
SQLTableSource tableSource = selectParser.parseTableSource();
udpateStatement.setTableSource(tableSource);
parseUpdateSet(udpateStatement);
if (lexer.token() == Token.FROM) {
lexer.nextToken();
SQLTableSource from = selectParser.parseTableSource();
udpateStatement.setFrom(from);
}
if (lexer.token() == (Token.WHERE)) {
lexer.nextToken();
udpateStatement.setWhere(this.exprParser.expr());
}
if (lexer.token() == Token.RETURNING) {
lexer.nextToken();
for (; ; ) {
udpateStatement.getReturning().add(this.exprParser.expr());
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
}
return udpateStatement;
}
Aggregations