I've got a fairly complicated query (multiple joins) on a normalized sqlite database. The query does a SELECT *
to enable some automated attribute selection logic (so I can't eliminate the "*")
The problem I am having is that my result set contains multiple columns with the same attribute name. For example, one attribute common to each table in the query is "_id". When I go to call "cursor.getColumnIndex("_id")"
the value returned is always the index of the last "_id"
attribute in the result set column list (i.e. not the one I want). I'd love to be able to use my SQL alias prefixes like cursor.getColumnIndex("A._id")
but that is not working.
QUESTIONs
- It appears that
cursor.getColumnIndex(AttributeName)
returns the index of the last "AttributeName". Can anyone confirm this? - Also, any suggestions on how return the index of the 1st attribute with "AttributeName"? or better the Xth attribute having "AttributeName"?