mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved mysql parser, update support cte fix #4289
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user