1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

extract the 'upgrade database' method. Since K-9 never had a pre-v18 database, I'm inclined to kill it, except it may serve as a useful template for the future

This commit is contained in:
Jesse Vincent 2008-11-01 04:26:03 +00:00
parent 521783ffff
commit 416aafb940

View File

@ -83,6 +83,19 @@ public class LocalStore extends Store {
}
mDb = SQLiteDatabase.openOrCreateDatabase(mPath, null);
if (mDb.getVersion() != DB_VERSION) {
doDbUpgrade(mDb);
}
mAttachmentsDir = new File(mPath + "_att");
if (!mAttachmentsDir.exists()) {
mAttachmentsDir.mkdirs();
}
}
private void doDbUpgrade ( SQLiteDatabase mDb) {
if (mDb.getVersion() < 18) {
if (Config.LOGV) {
Log.v(k9.LOG_TAG, String.format("Upgrading database from %d to %d", mDb
@ -117,11 +130,6 @@ public class LocalStore extends Store {
throw new Error("Database upgrade failed!");
}
}
mAttachmentsDir = new File(mPath + "_att");
if (!mAttachmentsDir.exists()) {
mAttachmentsDir.mkdirs();
}
}
@Override
public Folder getFolder(String name) throws MessagingException {
@ -374,7 +382,7 @@ public class LocalStore extends Store {
}
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[] {
mName,
25
k9.DEFAULT_VISIBLE_LIMIT
});
return true;
}