1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 10:19:33 +02:00

fixed database creation/updating: version will be checked & set inside transaction

This commit is contained in:
Nikolay Pultsin 2012-10-10 15:24:40 +04:00
parent a6caf30618
commit bcee5c29cb

View file

@ -75,11 +75,11 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
if (version >= currentVersion) {
return;
}
UIUtil.wait((version == 0) ? "creatingBooksDatabase" : "updatingBooksDatabase", new Runnable() {
UIUtil.wait(version == 0 ? "creatingBooksDatabase" : "updatingBooksDatabase", new Runnable() {
public void run() {
myDatabase.beginTransaction();
switch (version) {
switch (myDatabase.getVersion()) {
case 0:
createTables();
case 1:
@ -120,10 +120,10 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
updateTables18();
}
myDatabase.setTransactionSuccessful();
myDatabase.setVersion(currentVersion);
myDatabase.endTransaction();
myDatabase.execSQL("VACUUM");
myDatabase.setVersion(currentVersion);
}
}, context);
}