Bug 739066 - Don't include delete bookmarks/history in Combined view (r=margaret)

This commit is contained in:
Lucas Rocha 2012-03-30 17:31:31 +01:00
Родитель 60a9374697
Коммит 78190a5d24
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -64,7 +64,7 @@ public class BrowserProvider extends ContentProvider {
static final String DATABASE_NAME = "browser.db";
static final int DATABASE_VERSION = 5;
static final int DATABASE_VERSION = 6;
// Maximum age of deleted records to be cleaned up (20 days in ms)
static final long MAX_AGE_OF_DELETED_RECORDS = 86400000 * 20;
@ -393,6 +393,7 @@ public class BrowserProvider extends ContentProvider {
"-1 AS " + Combined.DATE_LAST_VISITED +
" FROM " + TABLE_BOOKMARKS +
" WHERE " + qualifyColumn(TABLE_BOOKMARKS, Bookmarks.TYPE) + " = " + Bookmarks.TYPE_BOOKMARK + " AND " +
qualifyColumn(TABLE_BOOKMARKS, Bookmarks.IS_DELETED) + " = 0 AND " +
qualifyColumn(TABLE_BOOKMARKS, Bookmarks.URL) +
" NOT IN (SELECT " + History.URL + " FROM " + TABLE_HISTORY + ")" +
" UNION ALL" +
@ -408,7 +409,8 @@ public class BrowserProvider extends ContentProvider {
qualifyColumn(TABLE_HISTORY, History.DATE_LAST_VISITED) + " AS " + Combined.DATE_LAST_VISITED +
" FROM " + TABLE_HISTORY + " LEFT OUTER JOIN " + TABLE_BOOKMARKS +
" ON " + qualifyColumn(TABLE_BOOKMARKS, Bookmarks.URL) + " = " + qualifyColumn(TABLE_HISTORY, History.URL) +
" WHERE " + qualifyColumn(TABLE_HISTORY, History.URL) + " IS NOT NULL AND (" +
" WHERE " + qualifyColumn(TABLE_HISTORY, History.URL) + " IS NOT NULL AND " +
qualifyColumn(TABLE_HISTORY, History.IS_DELETED) + " = 0 AND (" +
qualifyColumn(TABLE_BOOKMARKS, Bookmarks.TYPE) + " IS NULL OR " +
qualifyColumn(TABLE_BOOKMARKS, Bookmarks.TYPE) + " = " + Bookmarks.TYPE_BOOKMARK + ")" +
") LEFT OUTER JOIN " + TABLE_IMAGES +
@ -719,6 +721,13 @@ public class BrowserProvider extends ContentProvider {
createCombinedWithImagesView(db);
}
private void upgradeDatabaseFrom5to6(SQLiteDatabase db) {
debug("Dropping view: " + VIEW_COMBINED_WITH_IMAGES);
db.execSQL("DROP VIEW IF EXISTS " + VIEW_COMBINED_WITH_IMAGES);
createCombinedWithImagesView(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
debug("Upgrading browser.db: " + db.getPath() + " from " +
@ -745,6 +754,10 @@ public class BrowserProvider extends ContentProvider {
case 5:
upgradeDatabaseFrom4to5(db);
break;
case 6:
upgradeDatabaseFrom5to6(db);
break;
}
}