OSDN Git Service

Fix "drop table" problem.
authorGeorge Mount <mount@google.com>
Mon, 18 Mar 2013 17:05:55 +0000 (10:05 -0700)
committerGeorge Mount <mount@google.com>
Mon, 18 Mar 2013 17:14:20 +0000 (10:14 -0700)
 Bug 8404285
 Should drop table if exists when upgrading, not just drop a table.

Change-Id: Ic75fa0efc6ab44be073b2b78a8520e2289cd3148

src/com/android/photos/data/PhotoDatabase.java

index 3a9ad3c..f0aa4b6 100644 (file)
@@ -176,7 +176,7 @@ public class PhotoDatabase extends SQLiteOpenHelper {
     protected static void dropTable(SQLiteDatabase db, String table) {
         db.beginTransaction();
         try {
-            db.execSQL("drop table " + table);
+            db.execSQL("drop table if exists " + table);
             db.setTransactionSuccessful();
         } finally {
             db.endTransaction();