Bug 716089 - Fix query syntax for filtering URLs on local DB (r=blassey)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 10 Jan 2012 09:09:32 -0800
changeset 84133 9fb4756a6cbcc8caa8e1279f56df7cdb992b727e
parent 84132 e59ed78d1ed470d503fb9bb111e664a2a17505d8
child 84134 2b4c5610aa69ad332fe20527f0cd06cc071850bf
push id21828
push userbmo@edmorley.co.uk
push dateWed, 11 Jan 2012 02:40:23 +0000
treeherdermozilla-central@e79ef0ffcb09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs716089
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 716089 - Fix query syntax for filtering URLs on local DB (r=blassey)
mobile/android/base/db/LocalBrowserDB.java
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -83,17 +83,17 @@ public class LocalBrowserDB implements B
 
     public Cursor filter(ContentResolver cr, CharSequence constraint, int limit, CharSequence urlFilter) {
         Cursor c = cr.query(appendProfileAndLimit(History.CONTENT_URI, limit),
                             new String[] { History._ID,
                                            History.URL,
                                            History.TITLE,
                                            History.FAVICON,
                                            History.THUMBNAIL },
-                            (urlFilter != null ? "(" + History.URL + " NOT LIKE ? )" : "" )+ 
+                            (urlFilter != null ? "(" + History.URL + " NOT LIKE ? ) AND " : "" ) + 
                             "(" + History.URL + " LIKE ? OR " + History.TITLE + " LIKE ?)",
                             urlFilter == null ? new String[] {"%" + constraint.toString() + "%", "%" + constraint.toString() + "%"} :
                             new String[] {urlFilter.toString(), "%" + constraint.toString() + "%", "%" + constraint.toString() + "%"},
                             // ORDER BY is number of visits times a multiplier from 1 - 120 of how recently the site
                             // was accessed with a site accessed today getting 120 and a site accessed 119 or more
                             // days ago getting 1
                             History.VISITS + " * MAX(1, (" +
                             History.DATE_LAST_VISITED + " - " + new Date().getTime() + ") / 86400000 + 120) DESC");