Remove useless "LIMIT 1" on SQL queries

This commit is contained in:
Matthieu 2022-08-21 00:24:02 +02:00
parent 4d126e56a1
commit f96496e22d
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ interface InstanceDao {
@Query("SELECT * FROM instances") @Query("SELECT * FROM instances")
fun getAll(): List<InstanceDatabaseEntity> fun getAll(): List<InstanceDatabaseEntity>
@Query("SELECT * FROM instances WHERE uri=:instanceUri LIMIT 1") @Query("SELECT * FROM instances WHERE uri=:instanceUri")
fun getInstance(instanceUri: String): InstanceDatabaseEntity fun getInstance(instanceUri: String): InstanceDatabaseEntity
/** /**

View File

@ -27,7 +27,7 @@ interface UserDao {
@Query("SELECT * FROM users") @Query("SELECT * FROM users")
fun getAll(): List<UserDatabaseEntity> fun getAll(): List<UserDatabaseEntity>
@Query("SELECT * FROM users WHERE isActive=1 LIMIT 1") @Query("SELECT * FROM users WHERE isActive=1")
fun getActiveUser(): UserDatabaseEntity? fun getActiveUser(): UserDatabaseEntity?
@Query("UPDATE users SET isActive=0") @Query("UPDATE users SET isActive=0")
@ -39,6 +39,6 @@ interface UserDao {
@Query("DELETE FROM users WHERE isActive=1") @Query("DELETE FROM users WHERE isActive=1")
fun deleteActiveUsers() fun deleteActiveUsers()
@Query("SELECT * FROM users WHERE user_id=:id AND instance_uri=:instance_uri LIMIT 1") @Query("SELECT * FROM users WHERE user_id=:id AND instance_uri=:instance_uri")
fun getUserWithId(id: String, instance_uri: String): UserDatabaseEntity fun getUserWithId(id: String, instance_uri: String): UserDatabaseEntity
} }