return stmt;
}
public MySqlReplicateStatement parseReplicate() throws ParserException {
MySqlReplicateStatement stmt = new MySqlReplicateStatement();
acceptIdentifier("REPLACE");
if (identifierEquals("LOW_PRIORITY")) {
stmt.setLowPriority(true);
lexer.nextToken();
}
if (identifierEquals("DELAYED")) {
stmt.setDelayed(true);
lexer.nextToken();
}
if (lexer.token() == Token.INTO) {
lexer.nextToken();
}
SQLName tableName = exprParser.name();
stmt.setTableName(tableName);
if (lexer.token() == Token.VALUES || identifierEquals("VALUE")) {
lexer.nextToken();
for (;;) {
accept(Token.LPAREN);
SQLInsertStatement.ValuesClause values = new SQLInsertStatement.ValuesClause();
this.exprParser.exprList(values.getValues());
stmt.getValuesList().add(values);
accept(Token.RPAREN);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
} else {
break;
}
}
} else if (lexer.token() == Token.SELECT) {
SQLQueryExpr queryExpr = (SQLQueryExpr) this.exprParser.expr();
stmt.setQuery(queryExpr);
} else if (lexer.token() == Token.SET) {
lexer.nextToken();
for (;;) {
SQLUpdateSetItem item = new SQLUpdateSetItem();
item.setColumn(this.exprParser.name());
accept(Token.EQ);
item.setValue(this.exprParser.expr());
stmt.getSetItems().add(item);
if (lexer.token() == (Token.COMMA)) {
lexer.nextToken();
continue;
}