开发者

Android Java Sqlite Exception index 0 requested with size of 0

I think I understand what this error refers to. Basically as I understand it the cursor is empty. Which means the query is not finding any rows that equal its where statement.

The query is basically

SELECT * FROM questions WHERE _id=2

Now the thing I don't understand is that if I user a database with 7 records it is fine then when I change it over to one with 100 it runs 开发者_StackOverflow社区this exception. The odd thing is that from other parts of the app I output the entire databases contents referring to specific columns.

All the columns in both db's are called the same and when outputting everything from a table you can refer to everything. The problem seems to be when you query the large db specifically looking for one row. It returns empty.

Is there anything that would be doing this, like special characters or anything else I have over looked?


More code would be helpful. The obvious thing to do is verify that your large database has the correct filename, tablename and _id column and that there is a row with _id=2. Another thing I would try (probably not the problem) is to put quotes around the 2 -- WHERE _id='2'.


I've run into this issue in my app. For me it was because my cursors were exceeding the VM object memory limit of 1mb. This could be your issue.

Are you retrieving any blobs?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜