Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AttachmentDao.java « dao « db « adapters « sync « persistence « deck « nextcloud « niedermann « it « java « main « src « app - github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a8c0e5442d57c8b2842113fe3e882caca2ad4ed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Query;

import java.util.List;

import it.niedermann.nextcloud.deck.model.Attachment;

@Dao
public interface AttachmentDao extends GenericDao<Attachment> {
    @Query("SELECT * FROM attachment where cardId = :cardId")
    LiveData<List<Attachment>> getAttachmentsForCard(long cardId);

    @Query("SELECT * FROM attachment where accountId = :accountId and id = :remoteId")
    Attachment getAttachmentByRemoteIdDirectly(long accountId, Long remoteId);

    @Query("SELECT * FROM attachment where accountId = :accountId and localId = :id")
    Attachment getAttachmentByLocalIdDirectly(long accountId, Long id);

    @Query("SELECT * FROM attachment WHERE accountId = :accountId and cardId = :localCardId and (status<>1 or id is null or lastModified <> lastModifiedLocal)")
    List<Attachment> getLocallyChangedAttachmentsByLocalCardIdDirectly(long accountId, long localCardId);

}