Calling custom SQLite functions in Room

心不动则不痛 提交于 2020-01-13 18:04:03

问题


I include a custom build of sqlite in my app. I have several custom functions in that library, and I would like to call them from @Query in my Room DAOs. However I get an error that Room couldn't find those functions. Is there a way to tell Room that they exist WITHOUT using a @RawQuery?


回答1:


From Google:

Room can't verify queries with custom functions, please annotate your method with @SkipQueryVerification.

Room verifies your Dao queries using sqlite-jdbc which uses a vanilla prebuilt SQLite native library which doesn't have your custom functions and thus causes the verifier to fail. However, with the @SkipQueryVerification you can make Room skip verifying that query allowing you to still use Room but losing the ability to verify the query at runtime.



来源:https://stackoverflow.com/questions/56043431/calling-custom-sqlite-functions-in-room

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!