Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SQLite Error "requesting column name with table name"

Tags:

android

sqlite

After running an sql query of the form:

SELECT table_name.column_name FROM table_name,table_name2,etc... WHERE condition1,condition2,etc...,

I get the following error, which does not shut down my program:

requesting column name with table name -- table_name.column_name

A google search for this error phrase led me to android.database.sqlite.SQLiteCursor line 314

A few lines above line 314 there is a comment that this code is a response to bug 903852. But I can't seem to find this bug on google.

So this is a two part question:

  1. Is it wrong to name the column name with the table in SQL? (I was under the impression that this was a best practice)
  2. How do I find Android bug report 903852 so that I can understand what the issue is? (googling Android bug 903852 doesn't work)
like image 638
tjb Avatar asked Apr 09 '11 05:04

tjb


2 Answers

In my case, the problem was solved when I used

select table_name.column_name as column_name_alt WHERE ....

and later, in my CursorAdapter, referred to it in the string array only as column_name_alt.

Hope this helps.

like image 67
Animesh Avatar answered Oct 12 '22 18:10

Animesh


So I ran into this problem while creating a Cursor that would be passed to a SimpleCursorAdapter. Turns out that while it's OK to prefix your 'query' columns String[], the subsequent String[] from argument that's passed to the SimpleCursorAdapter constructor does not need to be prefixed in order for the Adapter to map your result set correctly.

like image 40
thom_nic Avatar answered Oct 12 '22 20:10

thom_nic