Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge "Fix bug #2927288 (CalendarCache table is not setup correctly) …

…- DO NOT MERGE" into froyo
  • Loading branch information...
commit 9be87f0a751a29226f6d2a57054eb0627d370b9b 2 parents d69a1a6 + 743270b
Fabrice Di Meglio authored Android (Google) Code Review committed
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/com/android/providers/calendar/CalendarDatabaseHelper.java
View
18 src/com/android/providers/calendar/CalendarDatabaseHelper.java
@@ -58,7 +58,7 @@
// Note: if you update the version number, you must also update the code
// in upgradeDatabase() to modify the database (gracefully, if possible).
- static final int DATABASE_VERSION = 69;
+ static final int DATABASE_VERSION = 70;
private static final int PRE_FROYO_SYNC_STATE_VERSION = 3;
@@ -428,7 +428,12 @@ private void createCalendarCacheTable(SQLiteDatabase db) {
"value TEXT" +
");");
- db.execSQL("INSERT INTO CalendarCache (key, value) VALUES (" +
+ initCalendarCacheTable(db);
+ }
+
+ private void initCalendarCacheTable(SQLiteDatabase db) {
+ db.execSQL("INSERT INTO CalendarCache (_id, key, value) VALUES (" +
+ CalendarCache.KEY_TIMEZONE_DATABASE_VERSION.hashCode() + "," +
"'" + CalendarCache.KEY_TIMEZONE_DATABASE_VERSION + "'," +
"'" + CalendarCache.DEFAULT_TIMEZONE_DATABASE_VERSION + "'" +
");");
@@ -532,6 +537,10 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
upgradeToVersion69(db);
oldVersion = 69;
}
+ if (oldVersion == 69) {
+ upgradeToVersion70(db);
+ oldVersion += 1;
+ }
} catch (SQLiteException e) {
Log.e(TAG, "onUpgrade: SQLiteException, recreating db. " + e);
dropTables(db);
@@ -565,6 +574,11 @@ private static boolean fixAllDayTime(Time time, String timezone, Long timeInMill
}
@VisibleForTesting
+ void upgradeToVersion70(SQLiteDatabase db) {
+ createCalendarCacheTable(db);
+ }
+
+ @VisibleForTesting
static void upgradeToVersion69(SQLiteDatabase db) {
// Clean up allDay events which could be in an invalid state from an earlier version
// Some allDay events had hour, min, sec not set to zero, which throws elsewhere. This
Please sign in to comment.
Something went wrong with that request. Please try again.