Java 类android.arch.persistence.room.Query 实例源码

项目:android-persistence    文件:LoanDao.java   
@Query("SELECT Loan.id, Book.title as title, User.name as name, Loan.startTime, Loan.endTime " +
        "FROM Book " +
        "INNER JOIN Loan ON Loan.book_id = Book.id " +
        "INNER JOIN User on User.id = Loan.user_id " +
        "WHERE User.name LIKE :userName " +
        "AND Loan.endTime > :after "
)
LiveData<List<LoanWithUserAndBook>> findLoansByNameAfter(String userName, Date after);
项目:FitnessHabits    文件:PhysicalDataDAO.java   
@Query("select PhysicalCategory.id, PhysicalCategory.categoryName, PhysicalCategory.intensity, PhysicalCategory.isFavorite, CategoryData.duration " +
        "from PhysicalCategory " +
        "left join (select PhysicalEntry.duration, PhysicalEntry.categoryId " +
        "from PhysicalEntry where PhysicalEntry.date = " +
        "(select currentViewDate from ParamRecord limit 1)) " +
        "as CategoryData " +
        "on PhysicalCategory.id = CategoryData.categoryId ")
LiveData<List<PhysicalData>> getToday();
项目:justintrain-client-android    文件:StationDaoRoom.java   
@Query("SELECT * FROM station")
List<Station> getAll();
项目:justintrain-client-android    文件:StationDaoRoom.java   
@Query("SELECT * FROM station WHERE name_fancy LIKE :nameFancy OR name_fancy LIKE :nameFancy2")
List<Station> getAllByNameFancy(String nameFancy, String nameFancy2);
项目:AndroidArchitectureComponets    文件:UserDao.java   
@Query("SELECT * FROM user")
List<User> selectAll();
项目:LoriApp    文件:UserDao.java   
@Query("DELETE FROM User")
void delete();
项目:Inshorts    文件:ArticleDao.java   
@Query("select * from Article ORDER BY TIMESTAMP ASC")
public Flowable<List<Article>> getAllArticlesByOldToNew();
项目:foco    文件:DocumentDao.java   
@Query("SELECT " + COLUMN_ID + ", " +COLUMN_NAME + ", " + COLUMN_WORKING_TIME +
        ", " + COLUMN_LAST_EDITION_TIME + ", " + COLUMN_WORDS + ", " + COLUMN_FAVORITE +
        ", " + COLUMN_COVER_COLOR +  ", " + COLUMN_COVER_IMAGE + " FROM " + TABLE_NAME +
        " WHERE " + COLUMN_ID + " = :docId")
DocumentMetadata getDocumentMetadata(long docId);
项目:EosCommander    文件:EosAccountDao.java   
@Query("SELECT account_name FROM eos_account WHERE account_name like :nameStarts ORDER BY account_name")
List<String> getAll(String nameStarts);
项目:elevator-room    文件:FloorDao.java   
@Query("SELECT * FROM " + VisitedFloor.TABLE)
List<VisitedFloor> loadAllPastFloors();
项目:android-room-with-a-view    文件:WordDao.java   
@Query("DELETE FROM word_table")
void deleteAll();
项目:SampleAppArch    文件:FeedEntryDAO.java   
@Query("SELECT * FROM feedEntrys")
LiveData<List<FeedEntry>> getAll();
项目:SampleAppArch    文件:FeedEntryDAO.java   
@Query("SELECT * FROM feedEntrys WHERE uid = :uid LIMIT 1")
LiveData<FeedEntry> findByUid(int uid);
项目:LoriApp    文件:TimeEntryDao.java   
@Query("SELECT * FROM TimeEntry WHERE description LIKE'%'||:text||'%'")
List<TimeEntry> findByText(String text);
项目:SampleAppArch    文件:RepoDao.java   
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@Query("SELECT login, avatarUrl,repoName, repoOwner, contributions FROM contributor "
    + "WHERE repoName = :name AND repoOwner = :owner "
    + "ORDER BY contributions DESC")
public abstract LiveData<List<Contributor>> loadContributors(String owner, String name);
项目:ProjectProgressTracker    文件:TodoDAO.java   
@Query("SELECT * FROM todo where project_ID LIKE  :pID")
LiveData<List<Todo>>  findByProjectID(int pID);
项目:SampleAppArch    文件:RepoDao.java   
@Query("SELECT * FROM RepoSearchResult WHERE query = :query")
public abstract LiveData<RepoSearchResult> search(String query);
项目:SampleAppArch    文件:RepoDao.java   
@Query("SELECT * FROM Repo WHERE id in (:repoIds)")
protected abstract LiveData<List<Repo>> loadById(List<Integer> repoIds);
项目:SampleAppArch    文件:RepoDao.java   
@Query("SELECT * FROM RepoSearchResult WHERE query = :query")
public abstract RepoSearchResult findSearchResult(String query);
项目:LoriApp    文件:UserDao.java   
@Query("SELECT * FROM User LIMIT 1")
User load();
项目:NewAndroidArchitecture    文件:CountryDao.java   
@Query("SELECT * FROM countries WHERE geonameId = :countryId")
Country loadCountry(int countryId);
项目:AndroidRoom    文件:PersonDAO.java   
@Query("SELECT * FROM person where city In (:cityIn)")
public List<Person> getPersonByCities(List<String> cityIn);
项目:OldNews    文件:ArticleDao.java   
@Query("UPDATE articles SET isFavourite = 0 WHERE id = :id")
public void setArticleUnfavourite(int id);
项目:android-architecture-components    文件:RepoDao.java   
@Query("SELECT * FROM RepoSearchResult WHERE query = :query")
public abstract RepoSearchResult findSearchResult(String query);
项目:android-architecture-components    文件:RepoDao.java   
@Query("SELECT * FROM RepoSearchResult WHERE query = :query")
public abstract LiveData<RepoSearchResult> search(String query);
项目:android-architecture-components    文件:CommentDao.java   
@Query("SELECT * FROM comments where productId = :productId")
List<CommentEntity> loadCommentsSync(int productId);
项目:android-architecture-components    文件:CommentDao.java   
@Query("SELECT * FROM comments where productId = :productId")
LiveData<List<CommentEntity>> loadComments(int productId);
项目:lead-management-android    文件:ContactTagJoinDao.java   
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@Query("SELECT * FROM tag INNER JOIN contacttagjoin ON tag.id = contacttagjoin.tagId WHERE contacttagjoin.contactId = :contactId")
List<Tag> getTagsForContact(String contactId);
项目:android-ponewheel    文件:AttributeDao.java   
@Query("SELECT distinct(\"key\") " +
        "FROM Attribute " +
        "INNER JOIN Moment on moment_id = moment.id " +
        "where ride_id = :rideId ")
public abstract List<String> getDistinctKeysFromRide(long rideId);
项目:curbmap-android    文件:RestrictionDao.java   
@Query("SELECT * FROM restriction")
List<Restriction> getAll();
项目:Android-MVVM    文件:UserDao.java   
@Query("SELECT * FROM user WHERE email = :email")
Flowable<User> loadUser(String email);
项目:LoriApp    文件:TaskDao.java   
@Query("SELECT * from Task WHERE id=:id")
Task load(String id);
项目:android-persistence    文件:LoanDao.java   
@Query("SELECT * From Loan")
LiveData<List<Loan>> findAllLoans();
项目:android-architecture-boilerplate    文件:LocalUserDao.java   
@Query(Constants.DELETE_ALL_USERS)
void deleteAllUsers();
项目:ProjectProgressTracker    文件:TodoDAO.java   
@Query("SELECT * FROM todo where tID LIKE  :tID")
LiveData<Todo> findByID(int tID);
项目:FitnessHabits    文件:DrinkDataDAO.java   
@Query("update DrinkEntry set consumed = consumed + :amount where categoryId = :categoryId and date =" +
        "(select currentViewDate from ParamRecord limit 1)")
void addToDrink(int categoryId, int amount);
项目:Moneycim    文件:SpendingDao.java   
@Query("SELECT SUM(QUANTITY) FROM SPENDING")
LiveData<Double> getTotalSpendingQuantity();
项目:LoriApp    文件:TimeEntryDao.java   
@Query("SELECT * FROM TimeEntry WHERE date BETWEEN :from AND :to")
List<TimeEntry> findByDate(Date from, Date to);
项目:AndroidRoom    文件:PersonDAO.java   
@Query("SELECT * FROM person where mobile = :mobileIn")
public LiveData<Person> getPersonByMobile(String mobileIn);
项目:FitnessHabits    文件:CommentDataDao.java   
@Query("select * " +
        "from CommentData where CommentData.date = " +
        "(select currentViewDate from ParamRecord limit 1)" +
        "and CommentData.category = 2")
LiveData<CommentData> getFoodComment();