Am I able to run SQL functions on a ContentResolver columns query?

送分小仙女□ 提交于 2019-12-22 10:19:58

问题


I am wondering if Android's ContentResolver supports using SQL functions over the columns when you query a ContentProvider. Such as SQLite3 date functions, to get a specific date format, or datediff?

What do you know about this?


回答1:


No. Even if you find it works for some cases, you cannot assume it works across the board.

ContentProvider is a facade. A given ContentProvider might use SQLite. It might use XML files. It might use JSON files. It might use CSV files. It might use some third-party SQL database. It might use some third-party object database. It might not have much of any local content, but instead have its stuff out in the cloud, reached via Web service calls. You can't even be sure that a ContentProvider necessarily supports a classic SQL WHERE clause -- some XML-backed ContentProvider might use XQuery syntax instead.

Hence, you definitely cannot rely upon a ContentProvider even knowing what datediff is.



来源:https://stackoverflow.com/questions/2495657/am-i-able-to-run-sql-functions-on-a-contentresolver-columns-query

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