> Has anyone ever inspected the column type of a field > in an SQL Lite Database dyanmically ? > > For example with the Cursor c you extract the current > column name via str = c.getColumnName(columnIndex) > > We want to extract the column type dynamically based on > the column index but there appears to be no call to do > this. There is however a getclassname but it does not > take a columnindex as a parameter. The idea here is to > scroll through the table and figure out the types and > perform conversion by dynamically querying the types. > > So the equivalent of c.getColumnObject(int colindex) > > or c.getColumnType(int colindex) is what is required here > > and type would be Blob, Short, String, Long, Int, Float.
SQLite uses "dynamic typing" (http://www.sqlite.org/datatype3.html), so I *guess* you're right there is no such a method in Android: it would be more or less useless because the column type is probably not even stored into the db itself... You may eventually use the typeof() SQLite3 function in order to discover the most compact type of a SQL expression. Giampaolo -- You received this message because you are subscribed to the Google Groups "Android Discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/android-discuss?hl=en.
