38 int wordStart = cursor;
39 boolean quoted =
false;
40 while (wordStart > 0 && Character.isJavaIdentifierPart(sql.charAt(wordStart - 1))) {
43 if ((wordStart > 0) && (sql.charAt(wordStart - 1) ==
'"')) {
49 return java.util.Collections.emptyList();
55 while (wordEnd < sql.length()
56 && Character.isJavaIdentifierPart(sql.charAt(wordEnd))) {
59 if (quoted && (wordEnd < sql.length()) && (sql.charAt(wordEnd) ==
'"')) {
65 String word = replaced[0] = sql.substring(wordStart, cursor);
66 if (wordStart < wordEnd) {
67 sql = sql.substring(0, wordStart) + sql.substring(wordEnd, sql.length());
72 List<SqlMoniker> completionHints =
76 return new ArrayList<>();
83 final List<SqlMoniker>
result;
84 if (word.length() > 0) {
85 result =
new java.util.ArrayList<SqlMoniker>();
88 word = word.substring(1);
89 for (SqlMoniker hint : completionHints) {
90 String cname = hint.toString();
91 if (cname.startsWith(word)) {
97 for (SqlMoniker hint : completionHints) {
98 String cname = hint.toString();
99 if ((cname.length() >= word.length())
100 && cname.substring(0, word.length()).equalsIgnoreCase(word)) {
106 result = completionHints;
List< SqlMoniker > applyPermissionsToTableHints(final List< SqlMoniker > completionHints)
HeavyDBSqlAdvisorValidator permissionsAwareValidator
static List< SqlMoniker > stripDatabaseFromTableHints(final List< SqlMoniker > completionHints)
boolean hasViolatedTablePermissions()