From 2fc42d76a3aa9aa4797459c272eaecc21185f76c Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Mon, 26 Oct 2015 09:30:27 +0800 Subject: [PATCH 1/8] Fix crash when upgrading db from < 2.0.0 --- .../alkitab/base/storage/InternalDbHelper.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java b/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java index d2d189d19..6313a2f5e 100644 --- a/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java +++ b/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java @@ -126,7 +126,7 @@ public void onOpen(SQLiteDatabase db) { } if (oldVersion < 14000163) { // last version that doesn't use Marker table - addGidColumnToLabel(db); + addGidColumnToLabelIfNeeded(db); createTableMarker(db); createIndexMarker(db); @@ -432,8 +432,18 @@ private void addShortNameColumnAndIndexToEdisi(SQLiteDatabase db) { db.execSQL("alter table Edisi add column shortName text"); } - private void addGidColumnToLabel(SQLiteDatabase db) { - db.execSQL("alter table " + Db.TABLE_Label + " add column " + Db.Label.gid + " text"); + private void addGidColumnToLabelIfNeeded(SQLiteDatabase db) { + boolean gidColumnExists = false; + try (Cursor c = db.rawQuery("pragma table_info(" + Db.TABLE_Label + ")", null)) { + while (c.moveToNext()) { + if ("gid".equals(c.getString(1 /* "name" column */))) { + gidColumnExists = true; + } + } + } + if (!gidColumnExists) { + db.execSQL("alter table " + Db.TABLE_Label + " add column " + Db.Label.gid + " text"); + } // make sure this one matches the one in createIndexLabel() db.execSQL("create index if not exists index_402 on " + Db.TABLE_Label + " (" + Db.Label.gid + ")"); From 34c39fe9ec0bdb41e1a0152e24b8380734d5388b Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Mon, 26 Oct 2015 09:31:34 +0800 Subject: [PATCH 2/8] Bump version --- Alkitab/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Alkitab/build.gradle b/Alkitab/build.gradle index d5e016dfc..dda2677dd 100644 --- a/Alkitab/build.gradle +++ b/Alkitab/build.gradle @@ -17,8 +17,8 @@ android { applicationId 'yuku.alkitab.debug' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 14000251 - versionName '4.3.1' + versionCode 14000252 + versionName '4.3.2' multiDexEnabled true } buildTypes { From a11fa752621dea548d8b39aa15361dafe7c60df2 Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Mon, 26 Oct 2015 11:27:55 +0800 Subject: [PATCH 3/8] shadowFromEntities do not use a String buffer, but convert to utf8 directly --- .idea/inspectionProfiles/Project_Default.xml | 1 + Alkitab/src/main/java/yuku/alkitab/base/U.java | 12 ++++++++++++ .../java/yuku/alkitab/base/sync/Sync_History.java | 11 +++++++++-- .../main/java/yuku/alkitab/base/sync/Sync_Mabel.java | 11 +++++++++-- .../main/java/yuku/alkitab/base/sync/Sync_Pins.java | 11 +++++++++-- .../main/java/yuku/alkitab/base/sync/Sync_Rp.java | 11 +++++++++-- 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 9e3bdcea0..567d06a32 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -2,6 +2,7 @@