mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
another solution for executeAsATransaction
This commit is contained in:
parent
d71d55e1da
commit
724d6fd313
3 changed files with 14 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.geometerplus.zlibrary.ui.android" android:versionCode="101061" android:versionName="1.1.6" android:installLocation="auto">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.geometerplus.zlibrary.ui.android" android:versionCode="101071" android:versionName="1.1.7" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="4" android:maxSdkVersion="10"/>
|
||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.1.6
|
||||
1.1.7
|
||||
|
|
|
@ -50,13 +50,21 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
|
|||
}
|
||||
|
||||
protected void executeAsATransaction(Runnable actions) {
|
||||
myDatabase.execSQL("BEGIN IMMEDIATE");
|
||||
boolean transactionStarted = false;
|
||||
try {
|
||||
myDatabase.beginTransaction();
|
||||
transactionStarted = true;
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
try {
|
||||
actions.run();
|
||||
} catch (Throwable t) {
|
||||
myDatabase.execSQL("ROLLBACK");
|
||||
if (transactionStarted) {
|
||||
myDatabase.setTransactionSuccessful();
|
||||
}
|
||||
} finally {
|
||||
myDatabase.execSQL("END");
|
||||
if (transactionStarted) {
|
||||
myDatabase.endTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue