从当前版本逐级升值最新版本,避免升级过程中数据的遗失。
@Override
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
for (int i = oldVersion; i < newVersion; i++) {
switch (i) {
case 1:
DataBaseHelper.upToDbVersion2(database);
break;
case 2:
DataBaseHelper.upToDbVersion3(database);
break;
default:
break;
}
}
}