This commit is contained in:
Thialfihar 2010-05-28 08:12:54 +00:00
parent eed42b2e34
commit 2f3bc6dcaf

View File

@ -160,17 +160,14 @@ public class Database extends SQLiteOpenHelper {
UserIds.USER_ID + " " + UserIds.USER_ID_type + "," +
UserIds.RANK + " " + UserIds.RANK_type + ");");
Cursor cursor = db.query("public_keys",
new String[]{
"c_key_data",
}, null, null, null, null, null);
Cursor cursor = db.query("public_keys", new String[] { "c_key_data" },
null, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
do {
byte[] data = cursor.getBlob(0);
try {
PGPPublicKeyRing keyRing = new PGPPublicKeyRing(data);
saveKeyRing(keyRing);
Log.e("good", "imported " + keyRing);
} catch (IOException e) {
Log.e("apg.db.upgrade", "key import failed: " + e);
} catch (GeneralException e) {
@ -183,17 +180,14 @@ public class Database extends SQLiteOpenHelper {
cursor.close();
}
cursor = db.query("secret_keys",
new String[]{
"c_key_data",
}, null, null, null, null, null);
cursor = db.query("secret_keys", new String[]{ "c_key_data" },
null, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
do {
byte[] data = cursor.getBlob(0);
try {
PGPSecretKeyRing keyRing = new PGPSecretKeyRing(data);
saveKeyRing(keyRing);
Log.e("good", "imported " + keyRing);
} catch (IOException e) {
Log.e("apg.db.upgrade", "key import failed: " + e);
} catch (PGPException e) {
@ -208,6 +202,9 @@ public class Database extends SQLiteOpenHelper {
cursor.close();
}
db.execSQL("DROP TABLE IF EXISTS public_keys;");
db.execSQL("DROP TABLE IF EXISTS secret_keys;");
break;
}