mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve parser ddl support
This commit is contained in:
@@ -129,6 +129,11 @@ public class SQLServerExprParser extends SQLExprParser {
|
||||
accept(Token.RPAREN);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.PERCENT) {
|
||||
lexer.nextToken();
|
||||
top.setPercent(true);
|
||||
}
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public class SQLServerLexer extends Lexer {
|
||||
map.put("TOP", Token.TOP);
|
||||
map.put("USE", Token.USE);
|
||||
map.put("WITH", Token.WITH);
|
||||
map.put("PERCENT", Token.PERCENT);
|
||||
|
||||
DEFAULT_SQL_SERVER_KEYWORDS = new Keywords(map);
|
||||
}
|
||||
|
||||
+2
-4
@@ -76,9 +76,7 @@ public class SQLServerSelectParser extends SQLSelectParser {
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.TOP) {
|
||||
SQLServerTop top = new SQLServerTop();
|
||||
lexer.nextToken();
|
||||
top.setExpr(createExprParser().primary());
|
||||
SQLServerTop top = this.createExprParser().parseTop();
|
||||
queryBlock.setTop(top);
|
||||
}
|
||||
|
||||
@@ -101,7 +99,7 @@ public class SQLServerSelectParser extends SQLSelectParser {
|
||||
return queryRest(queryBlock);
|
||||
}
|
||||
|
||||
protected SQLExprParser createExprParser() {
|
||||
protected SQLServerExprParser createExprParser() {
|
||||
return new SQLServerExprParser(lexer);
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -96,6 +96,10 @@ public class SQLServerOutputVisitor extends SQLASTOutputVisitor implements SQLSe
|
||||
print(")");
|
||||
}
|
||||
|
||||
if (x.isPercent()) {
|
||||
print(" PERCENT");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user