use of com.alibaba.druid.sql.dialect.sqlserver.ast.stmt.SQLServerUpdateStatement in project druid by alibaba.
the class SQLServerStatementParser method parseUpdateStatement.
public SQLUpdateStatement parseUpdateStatement() {
SQLServerUpdateStatement udpateStatement = createUpdateStatement();
accept(Token.UPDATE);
SQLServerTop top = this.getExprParser().parseTop();
if (top != null) {
udpateStatement.setTop(top);
}
SQLTableSource tableSource = this.exprParser.createSelectParser().parseTableSource();
udpateStatement.setTableSource(tableSource);
parseUpdateSet(udpateStatement);
SQLServerOutput output = this.getExprParser().parserOutput();
if (output != null) {
udpateStatement.setOutput(output);
}
if (lexer.token() == Token.FROM) {
lexer.nextToken();
SQLTableSource from = this.exprParser.createSelectParser().parseTableSource();
udpateStatement.setFrom(from);
}
if (lexer.token() == (Token.WHERE)) {
lexer.nextToken();
udpateStatement.setWhere(this.exprParser.expr());
}
return udpateStatement;
}
Aggregations