Ejemplo n.º 1
0
  /*
   * purge older/unattached data - use purgeAsync() to do this in the background
   */
  private static void purge() {
    SQLiteDatabase db = getWritableDb();
    db.beginTransaction();
    try {
      int numPostsDeleted = ReaderPostTable.purge(db);

      // don't bother purging other data unless posts were purged
      if (numPostsDeleted > 0) {
        AppLog.i(T.READER, String.format("%d total posts purged", numPostsDeleted));

        // purge unattached comments
        int numCommentsDeleted = ReaderCommentTable.purge(db);
        if (numCommentsDeleted > 0) {
          AppLog.i(T.READER, String.format("%d comments purged", numCommentsDeleted));
        }

        // purge unattached likes
        int numLikesDeleted = ReaderLikeTable.purge(db);
        if (numLikesDeleted > 0) {
          AppLog.i(T.READER, String.format("%d likes purged", numLikesDeleted));
        }

        // purge unattached thumbnails
        int numThumbsPurged = ReaderThumbnailTable.purge(db);
        if (numThumbsPurged > 0) {
          AppLog.i(T.READER, String.format("%d thumbnails purged", numThumbsPurged));
        }
      }
      db.setTransactionSuccessful();
    } finally {
      db.endTransaction();
    }
  }
Ejemplo n.º 2
0
 private void dropAllTables(SQLiteDatabase db) {
   ReaderCommentTable.dropTables(db);
   ReaderLikeTable.dropTables(db);
   ReaderPostTable.dropTables(db);
   ReaderTagTable.dropTables(db);
   ReaderUserTable.dropTables(db);
   ReaderThumbnailTable.dropTables(db);
   ReaderBlogTable.dropTables(db);
 }