Browse Source

Fail on inserting when record exists

main
M66B 6 years ago
parent
commit
4a43ebaafc
5 changed files with 7 additions and 15 deletions
  1. +1
    -2
      app/src/main/java/eu/faircode/email/DaoAccount.java
  2. +1
    -2
      app/src/main/java/eu/faircode/email/DaoAttachment.java
  3. +1
    -2
      app/src/main/java/eu/faircode/email/DaoFolder.java
  4. +1
    -2
      app/src/main/java/eu/faircode/email/DaoIdentity.java
  5. +3
    -7
      app/src/main/java/eu/faircode/email/DaoOperation.java

+ 1
- 2
app/src/main/java/eu/faircode/email/DaoAccount.java View File

@ -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


+ 1
- 2
app/src/main/java/eu/faircode/email/DaoAttachment.java View File

@ -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


+ 1
- 2
app/src/main/java/eu/faircode/email/DaoFolder.java View File

@ -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


+ 1
- 2
app/src/main/java/eu/faircode/email/DaoIdentity.java View File

@ -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


+ 3
- 7
app/src/main/java/eu/faircode/email/DaoOperation.java View File

@ -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…
Cancel
Save