From 9eb2b954c5ea3a3302b813f4bc0d741733aa1e5f Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Tue, 11 Dec 2007 01:22:50 -0800 Subject: [PATCH] Bug 407114 - "when viewing the "Most Visited" item of the "Smart Bookmarks" folder in the places organizer, the "Visit Date" column is empty" [p=mak77@supereva.it (Marco Bonardo [MaK77]) / sspitzer@mozilla.com (Seth Spitzer) r=sspitzer r=dietrich a1.9=damons] --- toolkit/components/places/src/nsNavHistory.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/toolkit/components/places/src/nsNavHistory.cpp b/toolkit/components/places/src/nsNavHistory.cpp index e76691d7b811..816755c2c828 100644 --- a/toolkit/components/places/src/nsNavHistory.cpp +++ b/toolkit/components/places/src/nsNavHistory.cpp @@ -23,6 +23,7 @@ * Dietrich Ayala * Seth Spitzer * Asaf Romano + * Marco Bonardo * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -2268,14 +2269,11 @@ nsNavHistory::ConstructQueryString(const nsCOMArray& aQueries // we generate a super-optimized SQL query if (IsHistoryMenuQuery(aQueries, aOptions, nsINavHistoryQueryOptions::SORT_BY_VISITCOUNT_DESCENDING)) { - // Note: visit_date column is null, which is acceptable for - // a menu (as it is unused) and we are not sorting by it. - // by not requiring the visit_date value, - // we can avoid JOINing against the moz_historyvisits, - // making this query very fast. queryString = NS_LITERAL_CSTRING( "SELECT h.id, h.url, h.title, h.rev_host, h.visit_count, " - "null, f.url, null, null " + "(SELECT MAX(visit_date) FROM moz_historyvisits WHERE place_id = h.id " + " AND visit_type <> 4 AND visit_type <> 0), " + "f.url, null, null " "FROM moz_places h " "LEFT OUTER JOIN moz_favicons f ON h.favicon_id = f.id WHERE " "h.id IN (SELECT id FROM moz_places WHERE hidden <> 1 "