FairEmail/app/src/main/java/eu/faircode/email/DaoOperation.java

50 lines
1.6 KiB
Java
Raw Normal View History

2018-08-02 13:33:06 +00:00
package eu.faircode.email;
/*
This file is part of Safe email.
Safe email is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
NetGuard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with NetGuard. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018 by Marcel Bokhorst (M66B)
*/
import java.util.List;
2018-08-08 06:55:47 +00:00
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
2018-08-08 06:55:47 +00:00
2018-08-02 13:33:06 +00:00
@Dao
public interface DaoOperation {
@Insert(onConflict = OnConflictStrategy.REPLACE)
long insertOperation(EntityOperation operation);
2018-08-09 20:45:42 +00:00
@Query("SELECT * FROM operation WHERE folder = :folder ORDER BY id")
List<EntityOperation> getOperations(long folder);
@Query("SELECT COUNT(id) FROM operation WHERE folder = :folder")
2018-08-04 22:35:47 +00:00
int getOperationCount(long folder);
@Update
void updateOperation(EntityOperation operation);
2018-08-02 13:33:06 +00:00
@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);
}