BoD/android-contentprovider-generator — pull request #33 by SimonHarrison (2014-08-25 12:35:02+00:00)
Title: fix problems with ambiguous column name _ID exceptions caused by _ID not...

... being fully qualified in queries with joins

This commit fixes cases where android-contentprovider-generator was generating SQL select statements that caused exceptions similar to:
```
android.database.sqlite.SQLiteException: ambiguous column name: _id (code 1): , while compiling: SELECT _id, distance FROM segment LEFT OUTER JOIN session ON segment.sessionid=session._id WHERE sessionid=? ORDER BY segment._id
```

With a schema like:

**segment.json:**
```
{
"fields": [
{
"name": "distance",
"type": "Integer",
"nullable": "true",
},
{
"name": "sessionId",
"type": "Long",
"nullable": false,
"foreignKey": {
"table": "Session",
"onDelete": "CASCADE",
}
}
]
}
```
**session.json:**
```
{
"fields": [
{
"name": "title",
"type": "String",
"nullable": "false",
},
{
"name": "sessionStatus",
"type": "enum",
"enumName": "SessionStatus",
"enumValues": [
"PENDING",
"ACTIVE",
"COMPLETE"
],
"nullable": "false",
},
]
}
```

There were three cases causing such an exception:

**1.** Any query with "_ID" (specified as Segment._ID, for example) in the projection. Note that most (all?) CursorAdapters *require* "_ID" in the projection. This case also has a bug in that a join was always applied since "_ID" is in both tables, even if the projection was only intended to access one table.

**2.** A query of the form getContentResolver("foo.bar/segment/#3")

**3.** A query like something.id(456).query(...) on an entity (table) with a foreign key.