@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);
@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();
@Query("SELECT * FROM station") List<Station> getAll();
@Query("SELECT * FROM station WHERE name_fancy LIKE :nameFancy OR name_fancy LIKE :nameFancy2") List<Station> getAllByNameFancy(String nameFancy, String nameFancy2);
@Query("SELECT * FROM user") List<User> selectAll();
@Query("DELETE FROM User") void delete();
@Query("select * from Article ORDER BY TIMESTAMP ASC") public Flowable<List<Article>> getAllArticlesByOldToNew();
@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);
@Query("SELECT account_name FROM eos_account WHERE account_name like :nameStarts ORDER BY account_name") List<String> getAll(String nameStarts);
@Query("SELECT * FROM " + VisitedFloor.TABLE) List<VisitedFloor> loadAllPastFloors();
@Query("DELETE FROM word_table") void deleteAll();
@Query("SELECT * FROM feedEntrys") LiveData<List<FeedEntry>> getAll();
@Query("SELECT * FROM feedEntrys WHERE uid = :uid LIMIT 1") LiveData<FeedEntry> findByUid(int uid);
@Query("SELECT * FROM TimeEntry WHERE description LIKE'%'||:text||'%'") List<TimeEntry> findByText(String text);
@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);
@Query("SELECT * FROM todo where project_ID LIKE :pID") LiveData<List<Todo>> findByProjectID(int pID);
@Query("SELECT * FROM RepoSearchResult WHERE query = :query") public abstract LiveData<RepoSearchResult> search(String query);
@Query("SELECT * FROM Repo WHERE id in (:repoIds)") protected abstract LiveData<List<Repo>> loadById(List<Integer> repoIds);
@Query("SELECT * FROM RepoSearchResult WHERE query = :query") public abstract RepoSearchResult findSearchResult(String query);
@Query("SELECT * FROM User LIMIT 1") User load();
@Query("SELECT * FROM countries WHERE geonameId = :countryId") Country loadCountry(int countryId);
@Query("SELECT * FROM person where city In (:cityIn)") public List<Person> getPersonByCities(List<String> cityIn);
@Query("UPDATE articles SET isFavourite = 0 WHERE id = :id") public void setArticleUnfavourite(int id);
@Query("SELECT * FROM comments where productId = :productId") List<CommentEntity> loadCommentsSync(int productId);
@Query("SELECT * FROM comments where productId = :productId") LiveData<List<CommentEntity>> loadComments(int productId);
@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);
@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);
@Query("SELECT * FROM restriction") List<Restriction> getAll();
@Query("SELECT * FROM user WHERE email = :email") Flowable<User> loadUser(String email);
@Query("SELECT * from Task WHERE id=:id") Task load(String id);
@Query("SELECT * From Loan") LiveData<List<Loan>> findAllLoans();
@Query(Constants.DELETE_ALL_USERS) void deleteAllUsers();
@Query("SELECT * FROM todo where tID LIKE :tID") LiveData<Todo> findByID(int tID);
@Query("update DrinkEntry set consumed = consumed + :amount where categoryId = :categoryId and date =" + "(select currentViewDate from ParamRecord limit 1)") void addToDrink(int categoryId, int amount);
@Query("SELECT SUM(QUANTITY) FROM SPENDING") LiveData<Double> getTotalSpendingQuantity();
@Query("SELECT * FROM TimeEntry WHERE date BETWEEN :from AND :to") List<TimeEntry> findByDate(Date from, Date to);
@Query("SELECT * FROM person where mobile = :mobileIn") public LiveData<Person> getPersonByMobile(String mobileIn);
@Query("select * " + "from CommentData where CommentData.date = " + "(select currentViewDate from ParamRecord limit 1)" + "and CommentData.category = 2") LiveData<CommentData> getFoodComment();