开发者

Get the affinity of a SQLite column on Android

开发者 https://www.devze.com 2023-02-04 19:55 出处:网络
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开发

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消