weimingtom / sqlitegen

Automatically exported from code.google.com/p/sqlitegen
1 stars 0 forks source link

SQLiteGen creates an _ID column instead of _id, which prevents usage with various Android SDK features (like CursorAdapter) #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a project that uses Android's CursorAdapter and generate an ORM with 
SQLiteGen. 
SQLiteGen has the rowid column as _ID.
2. Query the database and attach the cursor to the Cursor adapter.
3. Crash

What is the expected output? What do you see instead?
It should work, but does not because, CursorAdapter expects to find an _id 
field, not _ID. This is 
standard through most of the Android APIs regarding _id.
http://developer.android.com/reference/android/widget/CursorAdapter.html
"Adapter that exposes data from a Cursor to a ListView widget. The Cursor must 
include a 
column named "_id" or this class will not work."

I have worked around this by modifying the source for the plugin. Patch for fix 
is attached. (You'll 
want to revert the manifest and properties files)

Original issue reported on code.google.com by kou...@gmail.com on 23 Aug 2009 at 6:14

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for this.  I guess I hadn't realized that this behavior would be
case-sensitive.  I hope this doesn't break my existing tables.

Original comment by googlec...@antlersoft.com on 13 Oct 2009 at 4:05

GoogleCodeExporter commented 8 years ago
Latest release incorporates patch and works with old code/tables as well

Original comment by googlec...@antlersoft.com on 14 Oct 2009 at 8:17