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:
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) {
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue