[WISH] Cursor.GetObject() Or Cursor.GetColumnType?

laguilar

Member
Licensed User
Longtime User
I don't see this ability documented having a "Cursor.GetObject(ColumnName As String) As Object" or "Cursor.GetObject2(Index As Int) As Object" for SQL. in my situation im trying to put the variable directly into a map like so (Map.Put(cur.GetColumnName(c), cur.GetObject2(Index As Int))). maybe there is a way to do this that im not aware of. i've thought about using the PRAGMA table_info(`TABLENAME`) approach but some of the queries i use contain JOIN statements. so to build my maps i would need to run the PRAGMA command on each table in the query with JOINs. Any work-arounds anyone? or should i hope for this as a wish list item?
thanks.
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Yeah, Android really messed up not having a GetType from the Start. Best thing I can think of for this would be extending the Matrix Cursor and having an array or something storing types. That would still only work for known data though, and since SQLite allows random types of data it may not help much. There would need to be additional code with try/catch blocks to determine the types. I think I read somewhere that there is a SQL command to get types or read the meta data of the table, but that still only tells the intended type for that column and not what the current row is holding.
 
Top