Certificate email case insensitive

pull/169/head
M66B 5 years ago
parent 1fd7a9f77e
commit ea1b7c0a6d

@ -29,20 +29,16 @@ import java.util.List;
@Dao @Dao
public interface DaoCertificate { public interface DaoCertificate {
@Query("SELECT * FROM certificate" + @Query("SELECT * FROM certificate" +
" ORDER BY (email = :email) DESC, email, subject") " ORDER BY email, subject")
LiveData<List<EntityCertificate>> liveCertificates(String email); LiveData<List<EntityCertificate>> liveCertificates();
@Query("SELECT * FROM certificate" +
" WHERE id = :id")
EntityCertificate getCertificate(long id);
@Query("SELECT * FROM certificate" + @Query("SELECT * FROM certificate" +
" WHERE fingerprint = :fingerprint" + " WHERE fingerprint = :fingerprint" +
" AND email = :email") " AND email = :email COLLATE NOCASE")
EntityCertificate getCertificate(String fingerprint, String email); EntityCertificate getCertificate(String fingerprint, String email);
@Query("SELECT * FROM certificate" + @Query("SELECT * FROM certificate" +
" WHERE email = :email") " WHERE email = :email COLLATE NOCASE")
List<EntityCertificate> getCertificateByEmail(String email); List<EntityCertificate> getCertificateByEmail(String email);
@Insert @Insert

@ -94,7 +94,7 @@ public class FragmentCertificates extends FragmentBase {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
DB db = DB.getInstance(getContext()); DB db = DB.getInstance(getContext());
db.certificate().liveCertificates(null).observe(getViewLifecycleOwner(), new Observer<List<EntityCertificate>>() { db.certificate().liveCertificates().observe(getViewLifecycleOwner(), new Observer<List<EntityCertificate>>() {
@Override @Override
public void onChanged(List<EntityCertificate> certificates) { public void onChanged(List<EntityCertificate> certificates) {
if (certificates == null) if (certificates == null)

Loading…
Cancel
Save