improved mysql parser, update support cte fix #4289

This commit is contained in:
高铁
2021-06-07 01:23:02 +08:00
parent a6ff730eaf
commit 53f1dc56df
5 changed files with 49 additions and 0 deletions
@@ -2236,6 +2236,11 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
}
}
if (x.getWith() != null) {
x.getWith().accept(this);
println();
}
List<SQLExpr> returning = x.getReturning();
if (returning != null && returning.size() > 0) {
print0(ucase ? "SELECT " : "select ");
@@ -5257,6 +5257,10 @@ public class SQLStatementParser extends SQLParser {
HiveMultiInsertStatement insert = (HiveMultiInsertStatement) this.parseInsert();
insert.setWith(with);
return insert;
} else if (lexer.token == UPDATE) {
SQLUpdateStatement update = this.parseUpdateStatement();
update.setWith(with);
return update;
}
throw new ParserException("TODO. " + lexer.info());
@@ -3468,6 +3468,11 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
}
}
if (x.getWith() != null) {
x.getWith().accept(this);
println();
}
print0(ucase ? "UPDATE " : "update ");
printTableSource(x.getTableSource());