Group addresses for access notifications

This commit is contained in:
M66B 2016-02-07 09:43:28 +01:00
parent a2c1f1c5eb
commit 11dadcf93f
1 changed files with 7 additions and 3 deletions

View File

@ -454,9 +454,13 @@ public class DatabaseHelper extends SQLiteOpenHelper {
public Cursor getAccessUnset(int uid) { public Cursor getAccessUnset(int uid) {
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
return db.query("access", null, String query = "SELECT MAX(time) AS time, daddr, allowed";
"uid = ? AND block < 0", new String[]{Integer.toString(uid)}, query += " FROM access";
null, null, "time DESC"); query += " WHERE uid = ?";
query += " AND block < 0";
query += " GROUP BY daddr, allowed";
query += " ORDER BY time DESC";
return db.rawQuery(query, new String[]{Integer.toString(uid)});
} }
public long getRuleCount(int uid) { public long getRuleCount(int uid) {