I have an EditText
on fragment
where I want to enter a query directly, without a pre-installed Query annotation for the function. I wrote this function in Dao:
@Query(":query")
fun getList(query: String): Flow<List<String>>
in my ViewModel:
getList("SELECT * FROM my_table").collect {
// retrieve data
}
However, this method throws an error:
error: Must have exactly 1 query in the value of @Query or @DatabaseView
Is it even possible to write queries to the ROOM database
directly through UI?