diff --git a/app/src/main/java/eu/faircode/netguard/DatabaseHelper.java b/app/src/main/java/eu/faircode/netguard/DatabaseHelper.java index 818fa57a..459be089 100644 --- a/app/src/main/java/eu/faircode/netguard/DatabaseHelper.java +++ b/app/src/main/java/eu/faircode/netguard/DatabaseHelper.java @@ -34,7 +34,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { private static final String TAG = "NetGuard.Database"; private static final String DB_NAME = "Netguard"; - private static final int DB_VERSION = 12; + private static final int DB_VERSION = 13; private static boolean once = true; private static List logChangedListeners = new ArrayList<>(); @@ -97,6 +97,8 @@ public class DatabaseHelper extends SQLiteOpenHelper { ");"); db.execSQL("CREATE INDEX idx_log_time ON log(time)"); db.execSQL("CREATE INDEX idx_log_dest ON log(daddr)"); + db.execSQL("CREATE INDEX idx_log_dport ON log(dport)"); + db.execSQL("CREATE INDEX idx_log_dname ON log(dname)"); db.execSQL("CREATE INDEX idx_log_uid ON log(uid)"); } @@ -173,6 +175,11 @@ public class DatabaseHelper extends SQLiteOpenHelper { createTableAccess(db); oldVersion = 12; } + if (oldVersion < 13) { + db.execSQL("CREATE INDEX idx_log_dport ON log(dport)"); + db.execSQL("CREATE INDEX idx_log_dname ON log(dname)"); + oldVersion = 13; + } if (oldVersion == DB_VERSION) { db.setVersion(oldVersion); diff --git a/app/src/main/java/eu/faircode/netguard/ResourceRecord.java b/app/src/main/java/eu/faircode/netguard/ResourceRecord.java index 5e3e618e..8151ee21 100644 --- a/app/src/main/java/eu/faircode/netguard/ResourceRecord.java +++ b/app/src/main/java/eu/faircode/netguard/ResourceRecord.java @@ -29,19 +29,19 @@ public class ResourceRecord { public String AName; public String Resource; public int TTL; - private static DateFormat formater = SimpleDateFormat.getDateTimeInstance(); + private static DateFormat formatter = SimpleDateFormat.getDateTimeInstance(); public ResourceRecord() { } @Override public String toString() { - return formater.format( + return formatter.format( new Date(Time).getTime()) + " Q " + QName + " A " + AName + " R " + Resource + " TTL " + TTL + - " " + formater.format(new Date(Time + TTL * 1000L).getTime()); + " " + formatter.format(new Date(Time + TTL * 1000L).getTime()); } }