Don't duplicate sql string code as suggested by pserwylo

This commit is contained in:
Daniel Martí 2015-04-01 00:28:09 +02:00
parent 3db3a516eb
commit 11205dcf72

View File

@ -522,19 +522,19 @@ public class AppProvider extends FDroidProvider {
boolean firstColumn = true; boolean firstColumn = true;
for (final String column : columns) { for (final String column : columns) {
if (firstColumn) { if (firstColumn) {
selection.append("(");
firstColumn = false; firstColumn = false;
} else { } else {
selection.append("OR ("); selection.append("OR ");
} }
selection.append("(");
boolean firstKeyword = true; boolean firstKeyword = true;
for (final String keyword : keywords) { for (final String keyword : keywords) {
if (firstKeyword) { if (firstKeyword) {
selection.append(column + " like ?");
firstKeyword = false; firstKeyword = false;
} else { } else {
selection.append(" OR " + column + " like ?"); selection.append(" OR ");
} }
selection.append(column + " like ?");
selectionKeywords[iKeyword] = keyword; selectionKeywords[iKeyword] = keyword;
iKeyword++; iKeyword++;
} }