Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. @Override
  2. public Single<List<Questions>> getQuestions() {
  3. final String _sql = "SELECT * FROM questions_table";
  4. final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
  5. return Single.fromCallable(new Callable<List<Questions>>() {...}
  6. }
  7.  
  8. @Override
  9. public Flowable<List<Integer>> getCountAnswers(final int quizId, final boolean isAddQuest) {
  10. final String _sql = "SELECT count(id) FROM main_quiz_table WHERE quiz_id = ? AND add_question = ? AND user_ans_id > 0";
  11. final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 2);
  12. int _argIndex = 1;
  13. _statement.bindLong(_argIndex, quizId);
  14. _argIndex = 2;
  15. final int _tmp;
  16. _tmp = isAddQuest ? 1 : 0;
  17. _statement.bindLong(_argIndex, _tmp);
  18. return RxRoom.createFlowable(__db, new String[]{"main_quiz_table"}, new Callable<List<Integer>>() {...}
  19. }
  20.  
  21. @Override
  22. public Single<List<Questions>> getQuestions() {final String _sql = "SELECT * FROM questions_table";
  23. final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
  24. return RxRoom.createSingle(new Callable<List<Questions>>() {...}
  25. }
  26.  
  27. @Override
  28. public Flowable<List<Integer>> getCountAnswers(final int quizId, final boolean isAddQuest) {
  29. final String _sql = "SELECT count(id) FROM main_quiz_table WHERE quiz_id = :quizId AND add_question = :isAddQuest AND user_ans_id > 0";
  30. final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 2);
  31. int _argIndex = 1;
  32. _statement.bindLong(_argIndex, quizId);
  33. _argIndex = 2;
  34. final int _tmp;
  35. _tmp = isAddQuest ? 1 : 0;
  36. _statement.bindLong(_argIndex, _tmp);
  37. return RxRoom.createFlowable(__db, false, new String[]{"main_quiz_table"}, new Callable<List<Integer>>() {...}
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement