Use prefManager to update of not the main database

This commit is contained in:
jacques 2021-03-17 13:33:23 +01:00
parent a55b3a7552
commit 766a7d7174

View file

@ -57,8 +57,12 @@ class DBMedoc extends SQLiteOpenHelper {
public synchronized SQLiteDatabase getReadableDatabase() { public synchronized SQLiteDatabase getReadableDatabase() {
File dbFile = myContext.getDatabasePath(dbName); File dbFile = myContext.getDatabasePath(dbName);
if (dbFile.exists()) return super.getReadableDatabase(); //if (dbFile.exists()) return super.getReadableDatabase();
PrefManager prefManager = new PrefManager(myContext);
int oldVersion = prefManager.getDatabaseVersion();
if (oldVersion == DATABASE_VERSION) return super.getReadableDatabase();
copyDatabase(dbFile.getPath()); copyDatabase(dbFile.getPath());
return super.getReadableDatabase(); return super.getReadableDatabase();
} }