removing some useles type definitions in db queries

This commit is contained in:
tibbi 2023-01-13 23:14:38 +01:00
parent 2769669073
commit e40fbb9c77
1 changed files with 10 additions and 10 deletions

View File

@ -21,34 +21,34 @@ interface EventsDao {
@Query("SELECT * FROM events WHERE id = :id AND type = $TYPE_TASK") @Query("SELECT * FROM events WHERE id = :id AND type = $TYPE_TASK")
fun getTaskWithId(id: Long): Event? fun getTaskWithId(id: Long): Event?
@Query("SELECT * FROM events WHERE id = :id AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE id = :id")
fun getEventOrTaskWithId(id: Long): Event? fun getEventOrTaskWithId(id: Long): Event?
@Query("SELECT * FROM events WHERE import_id = :importId AND type = $TYPE_EVENT") @Query("SELECT * FROM events WHERE import_id = :importId AND type = $TYPE_EVENT")
fun getEventWithImportId(importId: String): Event? fun getEventWithImportId(importId: String): Event?
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0")
fun getOneTimeEventsOrTasksFromTo(toTS: Long, fromTS: Long): List<Event> fun getOneTimeEventsOrTasksFromTo(toTS: Long, fromTS: Long): List<Event>
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND start_ts >= :fromTS AND event_type IN (:eventTypeIds) AND type = $TYPE_TASK") @Query("SELECT * FROM events WHERE start_ts <= :toTS AND start_ts >= :fromTS AND event_type IN (:eventTypeIds) AND type = $TYPE_TASK")
fun getTasksFromTo(fromTS: Long, toTS: Long, eventTypeIds: List<Long>): List<Event> fun getTasksFromTo(fromTS: Long, toTS: Long, eventTypeIds: List<Long>): List<Event>
@Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0")
fun getOneTimeEventFromToWithId(id: Long, toTS: Long, fromTS: Long): List<Event> fun getOneTimeEventFromToWithId(id: Long, toTS: Long, fromTS: Long): List<Event>
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND start_ts != 0 AND repeat_interval = 0 AND event_type IN (:eventTypeIds) AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND start_ts != 0 AND repeat_interval = 0 AND event_type IN (:eventTypeIds)")
fun getOneTimeEventsFromToWithTypes(toTS: Long, fromTS: Long, eventTypeIds: List<Long>): List<Event> fun getOneTimeEventsFromToWithTypes(toTS: Long, fromTS: Long, eventTypeIds: List<Long>): List<Event>
@Query("SELECT * FROM events WHERE end_ts > :toTS AND repeat_interval = 0 AND event_type IN (:eventTypeIds) AND type = $TYPE_EVENT") @Query("SELECT * FROM events WHERE end_ts > :toTS AND repeat_interval = 0 AND event_type IN (:eventTypeIds) AND type = $TYPE_EVENT")
fun getOneTimeFutureEventsWithTypes(toTS: Long, eventTypeIds: List<Long>): List<Event> fun getOneTimeFutureEventsWithTypes(toTS: Long, eventTypeIds: List<Long>): List<Event>
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND repeat_interval != 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE start_ts <= :toTS AND repeat_interval != 0")
fun getRepeatableEventsOrTasksWithTypes(toTS: Long): List<Event> fun getRepeatableEventsOrTasksWithTypes(toTS: Long): List<Event>
@Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND repeat_interval != 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND repeat_interval != 0")
fun getRepeatableEventsOrTasksWithId(id: Long, toTS: Long): List<Event> fun getRepeatableEventsOrTasksWithId(id: Long, toTS: Long): List<Event>
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND start_ts != 0 AND repeat_interval != 0 AND event_type IN (:eventTypeIds) AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE start_ts <= :toTS AND start_ts != 0 AND repeat_interval != 0 AND event_type IN (:eventTypeIds)")
fun getRepeatableEventsOrTasksWithTypes(toTS: Long, eventTypeIds: List<Long>): List<Event> fun getRepeatableEventsOrTasksWithTypes(toTS: Long, eventTypeIds: List<Long>): List<Event>
@Query("SELECT * FROM events WHERE repeat_interval != 0 AND (repeat_limit == 0 OR repeat_limit > :currTS) AND event_type IN (:eventTypeIds) AND type = $TYPE_EVENT") @Query("SELECT * FROM events WHERE repeat_interval != 0 AND (repeat_limit == 0 OR repeat_limit > :currTS) AND event_type IN (:eventTypeIds) AND type = $TYPE_EVENT")
@ -73,7 +73,7 @@ interface EventsDao {
fun getEventsWithIds(ids: List<Long>): List<Event> fun getEventsWithIds(ids: List<Long>): List<Event>
//val selection = "$COL_REMINDER_MINUTES != -1 AND ($COL_START_TS > ? OR $COL_REPEAT_INTERVAL != 0) AND $COL_START_TS != 0" //val selection = "$COL_REMINDER_MINUTES != -1 AND ($COL_START_TS > ? OR $COL_REPEAT_INTERVAL != 0) AND $COL_START_TS != 0"
@Query("SELECT * FROM events WHERE reminder_1_minutes != -1 AND (start_ts > :currentTS OR repeat_interval != 0) AND start_ts != 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("SELECT * FROM events WHERE reminder_1_minutes != -1 AND (start_ts > :currentTS OR repeat_interval != 0) AND start_ts != 0")
fun getEventsOrTasksAtReboot(currentTS: Long): List<Event> fun getEventsOrTasksAtReboot(currentTS: Long): List<Event>
@Query("SELECT id FROM events") @Query("SELECT id FROM events")
@ -103,10 +103,10 @@ interface EventsDao {
@Query("UPDATE events SET import_id = :importId, source = :source WHERE id = :id AND type = $TYPE_EVENT") @Query("UPDATE events SET import_id = :importId, source = :source WHERE id = :id AND type = $TYPE_EVENT")
fun updateEventImportIdAndSource(importId: String, source: String, id: Long) fun updateEventImportIdAndSource(importId: String, source: String, id: Long)
@Query("UPDATE events SET repeat_limit = :repeatLimit WHERE id = :id AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("UPDATE events SET repeat_limit = :repeatLimit WHERE id = :id")
fun updateEventRepetitionLimit(repeatLimit: Long, id: Long) fun updateEventRepetitionLimit(repeatLimit: Long, id: Long)
@Query("UPDATE events SET repetition_exceptions = :repetitionExceptions WHERE id = :id AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") @Query("UPDATE events SET repetition_exceptions = :repetitionExceptions WHERE id = :id")
fun updateEventRepetitionExceptions(repetitionExceptions: String, id: Long) fun updateEventRepetitionExceptions(repetitionExceptions: String, id: Long)
@Deprecated("Use Context.updateTaskCompletion() instead unless you know what you are doing.") @Deprecated("Use Context.updateTaskCompletion() instead unless you know what you are doing.")