From f70fef25cbb10fc358598816870305400bb4d17b Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Mon, 7 Sep 2015 12:33:26 -0700 Subject: Never close the database --- app/src/main/java/org/connectbot/util/HostDatabase.java | 3 --- app/src/main/java/org/connectbot/util/PubkeyDatabase.java | 12 ------------ 2 files changed, 15 deletions(-) (limited to 'app/src/main/java/org') diff --git a/app/src/main/java/org/connectbot/util/HostDatabase.java b/app/src/main/java/org/connectbot/util/HostDatabase.java index 2f64015..1c42dce 100644 --- a/app/src/main/java/org/connectbot/util/HostDatabase.java +++ b/app/src/main/java/org/connectbot/util/HostDatabase.java @@ -148,8 +148,6 @@ public class HostDatabase extends RobustSQLiteOpenHelper { super(context, DB_NAME, null, DB_VERSION); this.displayDensity = context.getResources().getDisplayMetrics().density; - - getWritableDatabase().close(); } @Override @@ -216,7 +214,6 @@ public class HostDatabase extends RobustSQLiteOpenHelper { db.execSQL("DROP TABLE IF EXISTS " + TABLE_COLORS); db.execSQL("DROP TABLE IF EXISTS " + TABLE_COLOR_DEFAULTS); createTables(db); - db.close(); } @Override diff --git a/app/src/main/java/org/connectbot/util/PubkeyDatabase.java b/app/src/main/java/org/connectbot/util/PubkeyDatabase.java index 02bf5b9..3423f4b 100644 --- a/app/src/main/java/org/connectbot/util/PubkeyDatabase.java +++ b/app/src/main/java/org/connectbot/util/PubkeyDatabase.java @@ -100,11 +100,9 @@ public class PubkeyDatabase extends RobustSQLiteOpenHelper { public void deletePubkey(PubkeyBean pubkey) { HostDatabase hostdb = new HostDatabase(context); hostdb.stopUsingPubkey(pubkey.getId()); - hostdb.close(); SQLiteDatabase db = getWritableDatabase(); db.delete(TABLE_PUBKEYS, "_id = ?", new String[] { Long.toString(pubkey.getId()) }); - db.close(); } /** @@ -164,8 +162,6 @@ public class PubkeyDatabase extends RobustSQLiteOpenHelper { c.close(); } - db.close(); - return pubkeys; } @@ -189,8 +185,6 @@ public class PubkeyDatabase extends RobustSQLiteOpenHelper { c.close(); } - db.close(); - return pubkey; } @@ -230,8 +224,6 @@ public class PubkeyDatabase extends RobustSQLiteOpenHelper { c.close(); } - db.close(); - return list; } @@ -250,8 +242,6 @@ public class PubkeyDatabase extends RobustSQLiteOpenHelper { c.close(); } - db.close(); - return nickname; } @@ -322,8 +312,6 @@ public class PubkeyDatabase extends RobustSQLiteOpenHelper { pubkey.setId(id); } - db.close(); - return pubkey; } } -- cgit v1.2.3