From 0ea097293fdffcfa60c11a1b93ddefd0d7f4efd3 Mon Sep 17 00:00:00 2001 From: "myzcxhh@live.cn" Date: Sun, 8 Mar 2020 17:12:33 +0800 Subject: [PATCH] 3.0.2.19 ready --- dbv3/build.gradle | 4 ++-- .../src/main/java/com/kongzue/dbv3/util/DBHelper.java | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/dbv3/build.gradle b/dbv3/build.gradle index a367b22..29ea1a4 100644 --- a/dbv3/build.gradle +++ b/dbv3/build.gradle @@ -6,7 +6,7 @@ def siteUrl = 'https://github.com/kongzue/DBV3' //项目在github主页地址 def gitUrl = 'https://github.com/kongzue/DBV3.git' //Git仓库的地址 group = "com.kongzue.db"//发布aar前缀根节点 -version = "3.0.2.18"//发布aar的库版本 +version = "3.0.2.19"//发布aar的库版本 android { compileSdkVersion 29 @@ -15,7 +15,7 @@ android { minSdkVersion 19 targetSdkVersion 29 versionCode 13 - versionName "3.0.2.18" + versionName "3.0.2.19" } buildTypes { diff --git a/dbv3/src/main/java/com/kongzue/dbv3/util/DBHelper.java b/dbv3/src/main/java/com/kongzue/dbv3/util/DBHelper.java index d9ee42e..e8f0f04 100644 --- a/dbv3/src/main/java/com/kongzue/dbv3/util/DBHelper.java +++ b/dbv3/src/main/java/com/kongzue/dbv3/util/DBHelper.java @@ -67,9 +67,6 @@ public SQLiteDatabase getDb() { } private int dbVersion = 0; - private String createTableSQLCommand; - private String updateTableSQLCommand; - private String newTableSQLCommand; public int getDbVersion() { return dbVersion; @@ -163,16 +160,12 @@ public boolean createNewTable(String tableName, DBData dbData) { newTableSQLCommandBuffer.append(" " + key + " TEXT,"); } } - newTableSQLCommand = newTableSQLCommandBuffer.toString(); + String newTableSQLCommand = newTableSQLCommandBuffer.toString(); if (newTableSQLCommand.endsWith(",")) { newTableSQLCommand = newTableSQLCommand.substring(0, newTableSQLCommand.length() - 1); } newTableSQLCommand = newTableSQLCommand + ")"; log("SQL.exec: " + newTableSQLCommand); - if (dbVersion == 0 || db == null) { - createTableSQLCommand = newTableSQLCommand; - newTableSQLCommand = null; - } try { if (db != null) { db.execSQL(newTableSQLCommand); @@ -189,7 +182,7 @@ public boolean createNewTable(String tableName, DBData dbData) { //更新表 public boolean updateTable(String tableName, DBData dbData) { - updateTableSQLCommand = "ALTER TABLE " + tableName + " ADD "; + String updateTableSQLCommand = "ALTER TABLE " + tableName + " ADD "; List newKeys = new ArrayList<>(); List oldKeys = getTableAllKeys(tableName); for (String key : dbData.keySet()) {