mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve sql parser for sql server
This commit is contained in:
@@ -96,7 +96,7 @@ public class SQLExprParser extends SQLParser {
|
||||
lexer.nextToken();
|
||||
|
||||
SQLExpr expr = new SQLAllColumnExpr();
|
||||
|
||||
|
||||
if (lexer.token() == Token.DOT) {
|
||||
lexer.nextToken();
|
||||
accept(Token.STAR);
|
||||
@@ -706,7 +706,52 @@ public class SQLExprParser extends SQLParser {
|
||||
identName = lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
throw new ParserException("error " + lexer.token());
|
||||
switch (lexer.token()) {
|
||||
case MODEL:
|
||||
case PCTFREE:
|
||||
case INITRANS:
|
||||
case MAXTRANS:
|
||||
case SEGMENT:
|
||||
case CREATION:
|
||||
case IMMEDIATE:
|
||||
case DEFERRED:
|
||||
case STORAGE:
|
||||
case NEXT:
|
||||
case MINEXTENTS:
|
||||
case MAXEXTENTS:
|
||||
case MAXSIZE:
|
||||
case PCTINCREASE:
|
||||
case FLASH_CACHE:
|
||||
case CELL_FLASH_CACHE:
|
||||
case KEEP:
|
||||
case NONE:
|
||||
case LOB:
|
||||
case STORE:
|
||||
case ROW:
|
||||
case CHUNK:
|
||||
case CACHE:
|
||||
case NOCACHE:
|
||||
case LOGGING:
|
||||
case NOCOMPRESS:
|
||||
case KEEP_DUPLICATES:
|
||||
case EXCEPTIONS:
|
||||
case PURGE:
|
||||
case INITIALLY:
|
||||
case END:
|
||||
case COMMENT:
|
||||
case ENABLE:
|
||||
case DISABLE:
|
||||
case SEQUENCE:
|
||||
case USER:
|
||||
case ANALYZE:
|
||||
case OPTIMIZE:
|
||||
case GRANT:
|
||||
identName = lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
break;
|
||||
default:
|
||||
throw new ParserException("error " + lexer.token());
|
||||
}
|
||||
}
|
||||
|
||||
SQLName name = new SQLIdentifierExpr(identName);
|
||||
@@ -1382,6 +1427,13 @@ public class SQLExprParser extends SQLParser {
|
||||
column.getConstaints().add(check);
|
||||
return parseColumnRest(column);
|
||||
}
|
||||
|
||||
if (lexer.token == Token.DEFAULT) {
|
||||
lexer.nextToken();
|
||||
SQLExpr expr = this.expr();
|
||||
column.setDefaultExpr(expr);
|
||||
return parseColumnRest(column);
|
||||
}
|
||||
|
||||
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user