在Room中调用自定义SQLite函数

在Room中调用自定义SQLite函数

本文介绍了在Room中调用自定义SQLite函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中包含了一个自定义的sqlite版本.我在该库中有几个自定义函数,我想从我的Room DAO中的@Query调用它们.但是我收到一个错误,Room无法找到这些功能.有没有办法使用@RawQuery告诉Room它们不存在?

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?

推荐答案

来自Google:

Room使用sqlite-jdbc验证您的Dao查询,该sqlite-jdbc使用香草的预建SQLite本机库,该库没有您的自定义功能,因此会导致验证程序失败.但是,通过@SkipQueryVerification,您可以让Room跳过对该查询的验证,从而允许您仍然使用Room,但是却无法在运行时验证查询.

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.

这篇关于在Room中调用自定义SQLite函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 06:50