public SQLSelectStatement parseSelect() {
return new SQLSelectStatement(new MySqlSelectParser(this.exprParser).select());
}
public SQLUpdateStatement parseUpdateStatement() {
MySqlUpdateStatement stmt = createUpdateStatement();
if (lexer.token() == Token.UPDATE) {
lexer.nextToken();
if (identifierEquals(LOW_PRIORITY)) {
lexer.nextToken();
stmt.setLowPriority(true);
}
if (identifierEquals(IGNORE)) {
lexer.nextToken();
stmt.setIgnore(true);
}
SQLTableSource tableSource = this.exprParser.createSelectParser().parseTableSource();
stmt.setTableSource(tableSource);
}
accept(Token.SET);
for (;;) {
SQLUpdateSetItem item = new SQLUpdateSetItem();
item.setColumn(this.exprParser.name());
if (lexer.token() == Token.EQ) {
lexer.nextToken();
} else {
accept(Token.COLONEQ);
}
item.setValue(this.exprParser.expr());
stmt.getItems().add(item);
if (lexer.token() == (Token.COMMA)) {
lexer.nextToken();
continue;
}
break;
}
if (lexer.token() == (Token.WHERE)) {
lexer.nextToken();
stmt.setWhere(this.exprParser.expr());
}
stmt.setOrderBy(this.exprParser.parseOrderBy());
stmt.setLimit(parseLimit());
return stmt;
}