From 6689ac0b9d83e7161a0ab02e0c8ec592de1256aa Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Tue, 19 Feb 2013 15:53:03 -0500 Subject: [PATCH] Bug 842457 - Limit columns in queries used for getCount r=bnicholson --- mobile/android/base/db/LocalBrowserDB.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/db/LocalBrowserDB.java b/mobile/android/base/db/LocalBrowserDB.java index 9c9f3740956a..89635461a25c 100644 --- a/mobile/android/base/db/LocalBrowserDB.java +++ b/mobile/android/base/db/LocalBrowserDB.java @@ -185,23 +185,28 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface { 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 {