I'm using Room libs, have DB Stations and want to execute query to get Stations with/without filter.
UPD. I have DAO and I want to get all the records when my array (groupIds) is null or empty and get filtered list if I have at list one element in array.
@Query("SELECT * FROM $STATIONS_TABLE_NAME WHERE ((:groupIds) IS NULL OR $GROUP_ID IN(:groupIds))
fun getStationsWithFilter(groupIds: IntArray?): Flowable<List<DbStation>>
At this moment I had an issue
08-29 16:09:00.139 9508-9508/->BaseActivity: showError: exception - near ",": syntax error (code 1): , while compiling: SELECT * FROM Stations WHERE ((?,?,?,?,?,?,?,?,?,?) IS NOT NULL
So,
1) could I check for null passing value to query and dynamically chabge SQL query?
2) if yes - what the syntax issue I have?