mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-15 08:29:24 +00:00
Fail on inserting when record exists
This commit is contained in:
parent
56c6381557
commit
4a43ebaafc
5 changed files with 7 additions and 15 deletions
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
|
@ -59,7 +58,7 @@ public interface DaoAccount {
|
|||
" AND folder.type = '" + EntityFolder.INBOX + "') AS unseen")
|
||||
LiveData<TupleAccountStats> liveStats();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
@Insert
|
||||
long insertAccount(EntityAccount account);
|
||||
|
||||
@Update
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
|
@ -63,7 +62,7 @@ public interface DaoAttachment {
|
|||
@Query("SELECT content FROM attachment WHERE id = :id")
|
||||
byte[] getContent(long id);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
@Insert
|
||||
long insertAttachment(EntityAttachment attachment);
|
||||
|
||||
@Update
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
|
@ -80,7 +79,7 @@ public interface DaoFolder {
|
|||
@Query("SELECT * FROM folder WHERE type = '" + EntityFolder.OUTBOX + "'")
|
||||
EntityFolder getOutbox();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
@Insert
|
||||
long insertFolder(EntityFolder folder);
|
||||
|
||||
@Update
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
|
@ -43,7 +42,7 @@ public interface DaoIdentity {
|
|||
@Query("SELECT * FROM identity WHERE id = :id")
|
||||
LiveData<EntityIdentity> liveIdentity(long id);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
@Insert
|
||||
long insertIdentity(EntityIdentity identity);
|
||||
|
||||
@Update
|
||||
|
|
|
@ -23,27 +23,23 @@ import java.util.List;
|
|||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
@Dao
|
||||
public interface DaoOperation {
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
long insertOperation(EntityOperation operation);
|
||||
|
||||
@Query("SELECT * FROM operation WHERE folder = :folder ORDER BY id")
|
||||
List<EntityOperation> getOperations(long folder);
|
||||
|
||||
@Query("SELECT COUNT(id) FROM operation WHERE folder = :folder")
|
||||
int getOperationCount(long folder);
|
||||
|
||||
@Insert
|
||||
long insertOperation(EntityOperation operation);
|
||||
|
||||
@Update
|
||||
void updateOperation(EntityOperation operation);
|
||||
|
||||
@Query("DELETE FROM operation WHERE id = :id")
|
||||
void deleteOperation(long id);
|
||||
|
||||
@Query("DELETE FROM operation WHERE message = :id AND name = :name")
|
||||
int deleteOperations(long id, String name);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue