mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Filter null from db result
This commit is contained in:
parent
780c69d804
commit
24a8c528d0
2 changed files with 10 additions and 3 deletions
|
@ -15,6 +15,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.PublishSubject;
|
||||
|
@ -153,7 +154,9 @@ public class IdentityKeyStore {
|
|||
"""
|
||||
).formatted(TABLE_IDENTITY);
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
return Utils.executeQueryForStream(statement, this::getIdentityInfoFromResultSet).toList();
|
||||
return Utils.executeQueryForStream(statement, this::getIdentityInfoFromResultSet)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed read from identity store", e);
|
||||
|
|
|
@ -247,7 +247,9 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setInt(1, accountIdType);
|
||||
records = Utils.executeQueryForStream(statement,
|
||||
res -> new Pair<>(getKeyFromResultSet(res), getSessionRecordFromResultSet(res))).toList();
|
||||
res -> new Pair<>(getKeyFromResultSet(res), getSessionRecordFromResultSet(res)))
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
}
|
||||
for (final var record : records) {
|
||||
record.second().archiveCurrentState();
|
||||
|
@ -274,7 +276,9 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
statement.setInt(1, accountIdType);
|
||||
statement.setBytes(2, serviceId.toByteArray());
|
||||
records = Utils.executeQueryForStream(statement,
|
||||
res -> new Pair<>(getKeyFromResultSet(res), getSessionRecordFromResultSet(res))).toList();
|
||||
res -> new Pair<>(getKeyFromResultSet(res), getSessionRecordFromResultSet(res)))
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
}
|
||||
for (final var record : records) {
|
||||
record.second().archiveCurrentState();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue