Fixed
Status Update
Comments
da...@google.com <da...@google.com>
da...@google.com <da...@google.com> #2
This feature will be available in Room 2.1.0-alpha04
ph...@gmail.com <ph...@gmail.com> #3
I use next method in DAO:
@Query("UPDATE events SET visibility = 1 WHERE location IN (:locations)")
fun updateEvents(vararg locations: String): Single<Int>
In implementation class of DAO for generated method next statement is used:
final SupportSQLiteStatement _stmt = __preparedStmtOfUpdateEvents.acquire();
When invoked acquire() method then an exception is thrown: "java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time."
@Query("UPDATE events SET visibility = 1 WHERE location IN (:locations)")
fun updateEvents(vararg locations: String): Single<Int>
In implementation class of DAO for generated method next statement is used:
final SupportSQLiteStatement _stmt = __preparedStmtOfUpdateEvents.acquire();
When invoked acquire() method then an exception is thrown: "java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time."
da...@google.com <da...@google.com> #4
Thanks for the report comment #3 , I've filed a separate issue: https://issuetracker.google.com/issues/123695593 to address the bug in this feature.
cm...@gmail.com <cm...@gmail.com> #5
I have the same problem, but instead of Single I'm returning Completable. As I'm in 2.1.0-alpha04, it's supposed that this should work and not throw that exception, right?
Description
@Insert
fun addBook(book: Book) : Completable
we should expand this support for prepared queries:
@Query("INSERT INTO BOOK (id, name) VALUES (1, 'A Song of Ice and Fire')")
fun addAwesomeBook() : Completable