views:

195

answers:

1

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?

+4  A: 

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.

CommonsWare