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