mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
fixed database creation/updating: version will be checked & set inside transaction
This commit is contained in:
parent
a6caf30618
commit
bcee5c29cb
1 changed files with 3 additions and 3 deletions
|
@ -75,11 +75,11 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
|
||||||
if (version >= currentVersion) {
|
if (version >= currentVersion) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UIUtil.wait((version == 0) ? "creatingBooksDatabase" : "updatingBooksDatabase", new Runnable() {
|
UIUtil.wait(version == 0 ? "creatingBooksDatabase" : "updatingBooksDatabase", new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
myDatabase.beginTransaction();
|
myDatabase.beginTransaction();
|
||||||
|
|
||||||
switch (version) {
|
switch (myDatabase.getVersion()) {
|
||||||
case 0:
|
case 0:
|
||||||
createTables();
|
createTables();
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -120,10 +120,10 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
|
||||||
updateTables18();
|
updateTables18();
|
||||||
}
|
}
|
||||||
myDatabase.setTransactionSuccessful();
|
myDatabase.setTransactionSuccessful();
|
||||||
|
myDatabase.setVersion(currentVersion);
|
||||||
myDatabase.endTransaction();
|
myDatabase.endTransaction();
|
||||||
|
|
||||||
myDatabase.execSQL("VACUUM");
|
myDatabase.execSQL("VACUUM");
|
||||||
myDatabase.setVersion(currentVersion);
|
|
||||||
}
|
}
|
||||||
}, context);
|
}, context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue