Get the affinity of a SQLite column on Android
The SQLite C library has a method, sqlite3_column_decltype()
. But I cannot find any place where the Android SQLite API makes this method available. Is there any way to get the declared type of a colu开发者_开发技巧mn without running any SQL (i.e. can I avoid using PRAGMA table_info
)?
I could have used AbstractWindowedCursor.isBlob()
, but it says that it will also return true if the field is NULL. I need something that will guarantee me a value equal to the column's declared type.
I was wondering the same thing recently. The closest I've found is that the CursorWindow class has methods named isString
, isLong
, etc. But it's not clear whether this is based on affinity; the interface to these methods requires row as well as column info.
精彩评论