improved dm support, fix #3994

This commit is contained in:
高铁
2020-10-23 21:07:45 +08:00
parent 1bcf87c4b1
commit aea896c35b
3 changed files with 53 additions and 4 deletions
@@ -34,6 +34,7 @@ public class Keywords {
public final static Keywords DEFAULT_KEYWORDS;
public final static Keywords SQLITE_KEYWORDS;
public final static Keywords DM_KEYWORDS;
static {
Map<String, Token> map = new HashMap<String, Token>();
@@ -163,12 +164,25 @@ public class Keywords {
DEFAULT_KEYWORDS = new Keywords(map);
Map<String, Token> sqlitemap = new HashMap<String, Token>();
{
Map<String, Token> sqlitemap = new HashMap<String, Token>();
sqlitemap.putAll(Keywords.DEFAULT_KEYWORDS.getKeywords());
sqlitemap.putAll(Keywords.DEFAULT_KEYWORDS.getKeywords());
sqlitemap.put("LIMIT", Token.LIMIT);
SQLITE_KEYWORDS = new Keywords(sqlitemap);
sqlitemap.put("LIMIT", Token.LIMIT);
SQLITE_KEYWORDS = new Keywords(sqlitemap);
}
{
Map<String, Token> sqlitemap = new HashMap<String, Token>();
sqlitemap.putAll(Keywords.DEFAULT_KEYWORDS.getKeywords());
sqlitemap.put("MERGE", Token.MERGE);
sqlitemap.put("MATCHED", Token.MATCHED);
sqlitemap.put("USING", Token.USING);
DM_KEYWORDS = new Keywords(sqlitemap);
}
}
public boolean containsValue(Token token) {
@@ -132,6 +132,8 @@ public class Lexer {
if (DbType.sqlite == dbType) {
this.keywods = Keywords.SQLITE_KEYWORDS;
} else if (DbType.dm == dbType) {
this.keywods = Keywords.DM_KEYWORDS;
}
}