I started looking at content providers and they are only simple in
trivial cases. As soon as I need to step out of boundaries defined in
a trivial NotesList application, I am not sure where to look for
answers.

For example, I'd like to return a cursor over joined tables. It is not
clear how joined result could be described in a content provider.

As an example, let's assume I need to get list of phones and
corresponding names of people from Contacts, where people names
include letter 'i' and the result must be ordered by person _id. SQL
query would be something like that

sqlite> select people._id as _id, people.name, phones.number from
phones JOIN people ON phones.person = people._id where people.name
LIKE '%i%' order by people._id;

Most of the prefixes could be dropped except of a prefix for _id. In
my case I would have more name collisions. I also have to have
"people._id as _id" otherwise Android would not be able to find
expected column _id.

I am not sure how the same query could be expressed via Contacts
content provider.

managedQuery(Contacts.Phones.CONTENT_URI, new String[]
{Contacts.People._ID, Contacts.People.NAME,
Contacts.Phones.NUMBER}, // ?
                       String selection, String[] selectionArgs,  //?
people.name LIKE '%i%'
                       String sortOrder); //? people._id

Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to