mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for mysql create table parser, for issue #2999
This commit is contained in:
@@ -516,6 +516,16 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
column.setName(name());
|
||||
column.setDataType(parseDataType());
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.GENERATED)) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("ALWAYS");
|
||||
accept(Token.AS);
|
||||
accept(Token.LPAREN);
|
||||
SQLExpr expr = this.expr();
|
||||
accept(Token.RPAREN);
|
||||
column.setGeneratedAlawsAs(expr);
|
||||
}
|
||||
|
||||
return parseColumnRest(column);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,6 +269,13 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
dataType.accept(this);
|
||||
}
|
||||
|
||||
SQLExpr generatedAlawsAs = x.getGeneratedAlawsAs();
|
||||
if (generatedAlawsAs != null) {
|
||||
print0(ucase ? " GENERATED ALWAYS AS (" : " generated always as (");
|
||||
printExpr(generatedAlawsAs);
|
||||
print(')');
|
||||
}
|
||||
|
||||
final SQLExpr charsetExpr = x.getCharsetExpr();
|
||||
if (charsetExpr != null) {
|
||||
print0(ucase ? " CHARSET " : " charset ");
|
||||
|
||||
Reference in New Issue
Block a user