mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved h2 parser
This commit is contained in:
@@ -3758,7 +3758,8 @@ public class SQLExprParser extends SQLParser {
|
||||
return unionType;
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.GENERATED)) {
|
||||
if (lexer.identifierEquals(FnvHash.Constants.GENERATED)
|
||||
|| lexer.identifierEquals(FnvHash.Constants.RENAME)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4264,8 +4265,29 @@ public class SQLExprParser extends SQLParser {
|
||||
SQLExpr unitIndex = primary();
|
||||
column.setStep(unitIndex);
|
||||
}
|
||||
} else if (lexer.token == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
SQLColumnDefinition.Identity ident = new SQLColumnDefinition.Identity();
|
||||
if (lexer.token == Token.LITERAL_INT) {
|
||||
ident.setSeed(lexer.integerValue().intValue());
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
throw new ParserException("TODO : " + lexer.info());
|
||||
}
|
||||
|
||||
if (lexer.token == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
if (lexer.token == Token.LITERAL_INT) {
|
||||
ident.setIncrement(lexer.integerValue().intValue());
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
throw new ParserException("TODO : " + lexer.info());
|
||||
}
|
||||
}
|
||||
|
||||
column.setIdentity(ident);
|
||||
|
||||
accept(Token.RPAREN);
|
||||
}
|
||||
return parseColumnRest(column);
|
||||
}
|
||||
|
||||
@@ -1799,6 +1799,13 @@ public class SQLStatementParser extends SQLParser {
|
||||
} else if (lexer.token == Token.IDENTIFIER) {
|
||||
SQLAlterTableAddColumn item = parseAlterTableAddColumn();
|
||||
stmt.addItem(item);
|
||||
} else if (lexer.token == LPAREN) {
|
||||
if (dbType == DbType.h2) {
|
||||
lexer.nextToken();
|
||||
SQLAlterTableAddColumn item = parseAlterTableAddColumn();
|
||||
stmt.addItem(item);
|
||||
accept(RPAREN);
|
||||
}
|
||||
} else if (lexer.token == Token.COLUMN) {
|
||||
lexer.nextToken();
|
||||
SQLAlterTableAddColumn item = parseAlterTableAddColumn();
|
||||
|
||||
@@ -68,8 +68,6 @@ public enum Token {
|
||||
FOR("FOR"),
|
||||
IF("IF"),
|
||||
|
||||
|
||||
|
||||
GLOBAL("GLOBAL"),
|
||||
ALL("ALL"),
|
||||
UNION("UNION"),
|
||||
|
||||
Reference in New Issue
Block a user