mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for mysql parser.
This commit is contained in:
+7
-1
@@ -821,7 +821,13 @@ public class MySqlCreateTableParser extends SQLCreateTableParser {
|
||||
|
||||
accept(Token.LPAREN);
|
||||
for (;;) {
|
||||
SQLExpr expr = this.exprParser.expr();
|
||||
SQLExpr expr;
|
||||
if (lexer.token() == Token.LITERAL_ALIAS) {
|
||||
expr = this.exprParser.name();
|
||||
expr = this.exprParser.primaryRest(expr);
|
||||
} else {
|
||||
expr = this.exprParser.expr();
|
||||
}
|
||||
if (lexer.token() == Token.ASC) {
|
||||
lexer.nextToken();
|
||||
expr = new MySqlOrderingExpr(expr, SQLOrderingSpecification.ASC);
|
||||
|
||||
@@ -705,7 +705,13 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
|
||||
accept(Token.LPAREN);
|
||||
for (;;) {
|
||||
primaryKey.addColumn(this.expr());
|
||||
SQLExpr expr;
|
||||
if (lexer.token() == Token.LITERAL_ALIAS) {
|
||||
expr = this.name();
|
||||
} else {
|
||||
expr = this.expr();
|
||||
}
|
||||
primaryKey.addColumn(expr);
|
||||
if (!(lexer.token() == (Token.COMMA))) {
|
||||
break;
|
||||
} else {
|
||||
@@ -965,4 +971,9 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
}
|
||||
return partitionDef;
|
||||
}
|
||||
|
||||
protected SQLExpr parseAliasExpr(String alias) {
|
||||
String chars = alias.substring(1, alias.length() - 1);
|
||||
return new SQLCharExpr(chars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3651,7 +3651,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
} else if (lexer.identifierEquals("RENAME")) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
if (lexer.token() == Token.INDEX) {
|
||||
lexer.nextToken();
|
||||
SQLName name = this.exprParser.name();
|
||||
|
||||
Reference in New Issue
Block a user