Bug 487660 - Places depends on buggy behavior of SQLite's SUBSTR. r=dietrich, a=dveditz

git-svn-id: svn://10.0.0.236/trunk@256999 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sdwilsh%shawnwilsher.com
2009-04-21 15:44:09 +00:00
parent 71fa6dd59a
commit a77374a40d
2 changed files with 5 additions and 5 deletions

View File

@@ -2371,7 +2371,7 @@ nsNavHistory::FixInvalidFrecenciesForExcludedPlaces()
"JOIN moz_items_annos annos ON attrs.id = annos.anno_attribute_id "
"WHERE attrs.name = ?1) "
"AND visit_count = 0) "
"OR SUBSTR(h.url,0,6) = 'place:')"),
"OR SUBSTR(h.url, 1, 6) = 'place:')"),
getter_AddRefs(dbUpdateStatement));
NS_ENSURE_SUCCESS(rv, rv);
@@ -3777,7 +3777,7 @@ nsNavHistory::RemovePagesInternal(const nsCString& aPlaceIdsQueryString)
aPlaceIdsQueryString +
NS_LITERAL_CSTRING(") AND "
"NOT EXISTS (SELECT b.id FROM moz_bookmarks b WHERE b.fk = h.id LIMIT 1) "
"AND SUBSTR(h.url,0,6) <> 'place:')"));
"AND SUBSTR(h.url, 1, 6) <> 'place:')"));
NS_ENSURE_SUCCESS(rv, rv);
// placeId could have a livemark item, so setting the frecency to -1
@@ -5007,7 +5007,7 @@ nsNavHistory::QueryToSelectClause(nsNavHistoryQuery* aQuery, // const
// make it use the index.
if (NS_SUCCEEDED(aQuery->GetHasUri(&hasIt)) && hasIt) {
if (aQuery->UriIsPrefix())
clause.Condition("SUBSTR(h.url, 0, LENGTH(").Param(":uri").Str(")) =")
clause.Condition("SUBSTR(h.url, 1, LENGTH(").Param(":uri").Str(")) =")
.Param(":uri");
else
clause.Condition("h.url =").Param(":uri");

View File

@@ -646,7 +646,7 @@ nsNavHistoryExpire::EraseHistory(mozIStorageConnection* aConnection,
"(SELECT id FROM moz_historyvisits WHERE place_id = h.id LIMIT 1) "
"AND NOT EXISTS "
"(SELECT id FROM moz_bookmarks WHERE fk = h.id LIMIT 1) "
"AND SUBSTR(h.url,0,6) <> 'place:')"));
"AND SUBSTR(h.url, 1, 6) <> 'place:')"));
}
@@ -851,7 +851,7 @@ nsNavHistoryExpire::ExpireHistoryParanoid(mozIStorageConnection* aConnection,
"SELECT h.id FROM moz_places h "
"LEFT OUTER JOIN moz_historyvisits v ON h.id = v.place_id "
"LEFT OUTER JOIN moz_bookmarks b ON h.id = b.fk "
"WHERE v.id IS NULL AND b.id IS NULL AND SUBSTR(h.url,0,6) <> 'place:'");
"WHERE v.id IS NULL AND b.id IS NULL AND SUBSTR(h.url, 1, 6) <> 'place:'");
if (aMaxRecords != -1) {
query.AppendLiteral(" LIMIT ");
query.AppendInt(aMaxRecords);