mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for sql parser. for issue #1910
This commit is contained in:
@@ -20,7 +20,9 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.sql.XAConnection;
|
||||
|
||||
@@ -52,4 +54,23 @@ public class PGUtils {
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
private static Set<String> keywords;
|
||||
public static boolean isKeyword(String name) {
|
||||
if (name == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String name_lower = name.toLowerCase();
|
||||
|
||||
Set<String> words = keywords;
|
||||
|
||||
if (words == null) {
|
||||
words = new HashSet<String>();
|
||||
Utils.loadFromFile("META-INF/druid/parser/postgresql/keywords", words);
|
||||
keywords = words;
|
||||
}
|
||||
|
||||
return words.contains(name_lower);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user