Bug 842457 - Limit columns in queries used for getCount r=bnicholson
authorMark Finkle <mfinkle@mozilla.com>
Tue, 19 Feb 2013 15:53:03 -0500
changeset 122362 04c9844e37b8006b07f13979dba295e644214cd9
parent 122361 f24c228520836fa570404ec16dd4336d97cd2f5e
child 122363 7210fcb55aae33d75a2ead157d9c0459a53ff5af
push id24336
push userryanvm@gmail.com
push dateWed, 20 Feb 2013 12:07:46 +0000
treeherdermozilla-central@1bcc3c56b011 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs842457
milestone22.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 842457 - Limit columns in queries used for getCount r=bnicholson
mobile/android/base/db/LocalBrowserDB.java
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -180,33 +180,38 @@ public class LocalBrowserDB implements B
                             sortOrder);
 
         return new LocalDBCursor(c);
     }
 
     public int getCount(ContentResolver cr, String database) {
         Cursor cursor = null;
         int count = 0;
+        String[] columns = null;
         String constraint = null;
         try {
             Uri uri = null;
             if ("history".equals(database)) {
                 uri = mHistoryUriWithProfile;
+                columns = new String[] { History._ID };
                 constraint = Combined.VISITS + " > 0";
             } else if ("bookmarks".equals(database)) {
                 uri = mBookmarksUriWithProfile;
+                columns = new String[] { Bookmarks._ID };
                 // ignore folders, tags, keywords, separators, etc.
                 constraint = Bookmarks.TYPE + " = " + Bookmarks.TYPE_BOOKMARK;
             } else if ("thumbnails".equals(database)) {
                 uri = mThumbnailsUriWithProfile;
+                columns = new String[] { Thumbnails._ID };
             } else if ("favicons".equals(database)) {
                 uri = mFaviconsUriWithProfile;
+                columns = new String[] { Favicons._ID };
             }
             if (uri != null) {
-                cursor = cr.query(uri, null, constraint, null, null);
+                cursor = cr.query(uri, columns, constraint, null, null);
                 count = cursor.getCount();
             }
         } finally {
             if (cursor != null)
                 cursor.close();
         }
         debug("Got count " + count + " for " + database);
         return count;