mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 04:25:18 +00:00
Avatar check optimization.
This commit is contained in:
parent
2920e3e528
commit
7dffacf957
@ -276,10 +276,10 @@ public class GroupDatabase extends Database implements LokiGroupDatabaseProtocol
|
|||||||
|
|
||||||
public boolean hasAvatar(String groupId) {
|
public boolean hasAvatar(String groupId) {
|
||||||
try (Cursor cursor = databaseHelper.getReadableDatabase().rawQuery(
|
try (Cursor cursor = databaseHelper.getReadableDatabase().rawQuery(
|
||||||
"SELECT COUNT("+ID+") FROM "+TABLE_NAME+" WHERE "+GROUP_ID+" == ? AND "+AVATAR+" NOT NULL",
|
"SELECT EXISTS(SELECT 1 FROM "+TABLE_NAME+" WHERE "+GROUP_ID+" == ? AND "+AVATAR+" NOT NULL LIMIT 1)",
|
||||||
new String[]{groupId})) {
|
new String[]{groupId})) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
return cursor.getInt(0) > 0;
|
return cursor.getInt(0) == 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user