mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql server parser, support merge. for issue #2118
This commit is contained in:
@@ -44,6 +44,10 @@ public class SQLServerLexer extends Lexer {
|
||||
map.put("BEGIN", Token.BEGIN);
|
||||
map.put("END", Token.END);
|
||||
|
||||
map.put("MERGE", Token.MERGE);
|
||||
map.put("USING", Token.USING);
|
||||
map.put("MATCHED", Token.MATCHED);
|
||||
|
||||
DEFAULT_SQL_SERVER_KEYWORDS = new Keywords(map);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,19 +334,19 @@ public class SQLStatementParser extends SQLParser {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals("RELEASE")) {
|
||||
if (lexer.identifierEquals(FnvHash.Constants.RELEASE)) {
|
||||
SQLStatement stmt = parseReleaseSavePoint();
|
||||
statementList.add(stmt);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals("SAVEPOINT")) {
|
||||
if (lexer.identifierEquals(FnvHash.Constants.SAVEPOINT)) {
|
||||
SQLStatement stmt = parseSavePoint();
|
||||
statementList.add(stmt);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals("ROLLBACK")) {
|
||||
if (lexer.identifierEquals(FnvHash.Constants.ROLLBACK)) {
|
||||
SQLRollbackStatement stmt = parseRollback();
|
||||
statementList.add(stmt);
|
||||
|
||||
@@ -358,6 +358,13 @@ public class SQLStatementParser extends SQLParser {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.MERGE)) {
|
||||
SQLStatement stmt = parseMerge();
|
||||
stmt.setParent(parent);
|
||||
statementList.add(stmt);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.COMMIT)) {
|
||||
SQLStatement stmt = parseCommit();
|
||||
|
||||
|
||||
@@ -615,5 +615,10 @@ public final class FnvHash {
|
||||
long SORTED = fnv1a_64_lower("SORTED");
|
||||
long LIFECYCLE = fnv1a_64_lower("LIFECYCLE");
|
||||
long PARTITIONS = fnv1a_64_lower("PARTITIONS");
|
||||
|
||||
long ROLLBACK = fnv1a_64_lower("ROLLBACK");
|
||||
long SAVEPOINT = fnv1a_64_lower("SAVEPOINT");
|
||||
long RELEASE = fnv1a_64_lower("RELEASE");
|
||||
long MERGE = fnv1a_64_lower("MERGE");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user