Bug 794631 - Don't add useless WHERE clauses to empty filter queries. r=lucasr

This commit is contained in:
Margaret Leibovic 2012-09-26 14:27:06 -07:00
parent 26ad5de498
commit af3a59eda5

View File

@ -24,6 +24,7 @@ import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.provider.Browser;
import android.text.TextUtils;
import android.util.Log;
import java.io.ByteArrayOutputStream;
@ -138,6 +139,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
// The combined history/bookmarks selection queries for sites with a url or title containing
// the constraint string(s), treating space-separated words as separate constraints
if (!TextUtils.isEmpty(constraint)) {
String[] constraintWords = constraint.toString().split(" ");
for (int i = 0; i < constraintWords.length; i++) {
selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " LIKE ? OR " +
@ -146,6 +148,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
selectionArgs = DBUtils.appendSelectionArgs(selectionArgs,
new String[] { constraintWord, constraintWord });
}
}
if (urlFilter != null) {
selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " NOT LIKE ?)");