bug fixed for sql parser.

This commit is contained in:
wenshao
2017-09-04 14:40:40 +08:00
parent 5ab33e0566
commit 9990e07aaa
3 changed files with 13 additions and 5 deletions
@@ -195,7 +195,15 @@ public class MySqlCreateTableParser extends SQLCreateTableParser {
if (lexer.token() == Token.EQ) {
lexer.nextToken();
}
stmt.getTableOptions().put("ENGINE", this.exprParser.expr());
SQLExpr expr = null;
if (lexer.token() == Token.MERGE) {
expr = new SQLIdentifierExpr(lexer.stringVal());
lexer.nextToken();
} else {
expr = this.exprParser.expr();
}
stmt.getTableOptions().put("ENGINE", expr);
continue;
}
@@ -2097,7 +2097,7 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
@Override
public boolean visit(OracleCreateTableStatement x) {
printCreateTable(x);
printCreateTable(x, false);
if (x.getOf() != null) {
println();
@@ -2367,12 +2367,12 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
}
public boolean visit(SQLCreateTableStatement x) {
printCreateTable(x);
printCreateTable(x, true);
return false;
}
protected void printCreateTable(SQLCreateTableStatement x) {
protected void printCreateTable(SQLCreateTableStatement x, boolean printSelect) {
print0(ucase ? "CREATE " : "create ");
final SQLCreateTableStatement.Type tableType = x.getType();
@@ -2394,7 +2394,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
}
SQLSelect select = x.getSelect();
if (select != null) {
if (printSelect && select != null) {
println();
print0(ucase ? "AS" : "as");