androidx.room.Query Java Examples

The following examples show how to use androidx.room.Query. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccountDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select account.id as id, username,password,sessionResource,accountId from credentials join account on credentialsId = credentials.id where account.id=:id limit 1")
public abstract ListenableFuture<AccountWithCredentials> getAccountFuture(Long id);
 
Example #2
Source File: GroupMessageDao.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
@Query("SELECT * FROM " + GroupMessage.TABLE_NAME + " WHERE _id != :indexId AND data_hash = :hash LIMIT 1")
@Nullable GroupMessage getExistMessageAttachment(long indexId, String hash);
 
Example #3
Source File: AlarmsDatabaseDao.java    From BaldPhone with Apache License 2.0 4 votes vote down vote up
@Query("DELETE FROM Alarm")
void deleteAll();
 
Example #4
Source File: GroupMessageDao.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
@Query("SELECT * FROM " + GroupMessage.TABLE_NAME + " WHERE gid = " + " :gid" + " AND from_uid = :from_uid" + " AND content_type = 1" + " AND create_time >= :startTime" + " AND create_time <= :endTime")
List<GroupMessage> fetchMessagesBySenderAndPeriod(long gid, String from_uid, long startTime, long endTime);
 
Example #5
Source File: QueryDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("update `query` set state=:newState where state=:oldState and id=:queryId")
abstract int updateQueryState(Long queryId, String newState, String oldState);
 
Example #6
Source File: ThreadAndEmailDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Transaction
@Query("select id from email where threadId in (:threadIds)")
public abstract List<EmailWithMailboxes> getEmailsWithMailboxes(Collection<String> threadIds);
 
Example #7
Source File: RemindersDatabaseDao.java    From BaldPhone with Apache License 2.0 4 votes vote down vote up
@Query("DELETE FROM Reminder")
void deleteAll();
 
Example #8
Source File: OverwriteDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("delete from keyword_overwrite where threadId=:threadId")
protected abstract int deleteKeywordOverwritesByThread(String threadId);
 
Example #9
Source File: MailboxDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select id,role,name from mailbox where role=:role limit 1")
public abstract ListenableFuture<MailboxWithRoleAndName> getMailboxFuture(Role role);
 
Example #10
Source File: GroupLiveInfoDao.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
@Query("SELECT * FROM " + GroupLiveInfo.TABLE_NAME + " LIMIT 100 OFFSET :page")
List<GroupLiveInfo> queryByPage(int page);
 
Example #11
Source File: OverwriteDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("delete from query_item_overwrite where threadId in (:threadIds)")
public abstract int deleteQueryOverwritesByThread(Collection<String> threadIds);
 
Example #12
Source File: MailboxDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("update mailbox set unreadThreads=:value where id=:id")
public abstract void updateUnreadThreads(String id, Long value);
 
Example #13
Source File: VideoDao.java    From tv-samples with Apache License 2.0 4 votes vote down vote up
@Query("SELECT * FROM " + DatabaseColumnConstant.VideoEntry.TABLE_NAME
        + " WHERE " + DatabaseColumnConstant.VideoEntry.COLUMN_CATEGORY
        + " = :category")
LiveData<List<VideoEntity>> loadVideoInSameCateogry(String category);
 
Example #14
Source File: MailboxDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select id from mailbox where role in (:roles) order by role")
public abstract String[] getMailboxes(Role... roles);
 
Example #15
Source File: QueryDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("delete from query_item_overwrite where executed=1 and queryId=:queryId")
abstract int deleteAllExecuted(Long queryId);
 
Example #16
Source File: DownloadDao.java    From Pixiv-Shaft with MIT License 4 votes vote down vote up
@Query("SELECT * FROM upload_image_table ORDER BY uploadTime DESC")
List<ImageEntity> getUploadedImage();
 
Example #17
Source File: ThreadAndEmailDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query(" select threadId from `query` join query_item on `query`.id = queryId where threadId not in(select thread.threadId from thread) and queryString=:queryString")
public abstract List<String> getMissingThreadIds(String queryString);
 
Example #18
Source File: AlarmsDatabaseDao.java    From BaldPhone with Apache License 2.0 4 votes vote down vote up
@Query("SELECT * FROM Alarm ORDER BY hour ASC, minute ASC")
List<Alarm> getAllSortedByTime();
 
Example #19
Source File: ThreadAndEmailDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select position,emailId from thread_item where threadId=:threadId order by position")
public abstract ListenableFuture<List<ExpandedPosition>> getAllPositions(String threadId);
 
Example #20
Source File: QueryDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("update query_item set position=position+1 where queryId=:queryId and position>=:position ")
abstract int incrementAllPositionsFrom(Long queryId, Long position);
 
Example #21
Source File: MailboxDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select id,parentId,name,sortOrder,unreadThreads,totalThreads,role from mailbox where role=:role limit 1")
public abstract MailboxOverviewItem getMailboxOverviewItem(Role role);
 
Example #22
Source File: RemindersDatabaseDao.java    From BaldPhone with Apache License 2.0 4 votes vote down vote up
@Query("DELETE FROM Reminder WHERE id IN (:ids)")
void removeReminders(int... ids);
 
Example #23
Source File: AppsDatabaseDao.java    From BaldPhone with Apache License 2.0 4 votes vote down vote up
@Query("SELECT COUNT(*) FROM App")
int getNumberOfRows();
 
Example #24
Source File: IllustRecmdDao.java    From Pixiv-Shaft with MIT License 4 votes vote down vote up
@Query("SELECT * FROM (SELECT * FROM illust_recmd_table ORDER BY time DESC LIMIT 20) ORDER BY time")
List<IllustRecmdEntity> getAll();
 
Example #25
Source File: AlarmsDatabaseDao.java    From BaldPhone with Apache License 2.0 4 votes vote down vote up
@Query("UPDATE Alarm SET enabled=:enabled WHERE `key` = :key")
void update(int key, boolean enabled);
 
Example #26
Source File: AccountDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select account.id as id, username,password,sessionResource,accountId from credentials join account on credentialsId = credentials.id order by lastSelectedAt desc limit 1")
public abstract ListenableFuture<AccountWithCredentials> getMostRecentlySelectedAccountFuture();
 
Example #27
Source File: StateDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select emailId as id,position from `query` join query_item on `query`.id = queryId  where queryString=:queryString order by position desc limit 1")
abstract QueryStateWrapper.UpTo getUpTo(String queryString);
 
Example #28
Source File: QueryDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select * from `query` where queryString=:queryString")
abstract QueryEntity getQueryEntity(String queryString);
 
Example #29
Source File: MailboxDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("select id,role,name from mailbox where role=:role limit 1")
public abstract MailboxWithRoleAndName getMailbox(Role role);
 
Example #30
Source File: ThreadAndEmailDao.java    From lttrs-android with Apache License 2.0 4 votes vote down vote up
@Query("delete from thread")
abstract void deleteAllThread();