質問

For example, if i use following code to query some data from database.

Uri uri = Uri.parse("content://com.android.contacts/contacts?address_book_index_extras=true");
        String selection = "LEFT OUTER JOIN (select raw_contact_id, data1 from data where mimetype_id = 5) AS phone_data ON(_id = phone_data.raw_contact_id)"; 
        Cursor c = getContentResolver().query(Contacts.CONTENT_URI, null, selection, null, null);

What i want to ask is after the query method, does database copy its result set to cursor or just make cursor something like a pointer and point to the first line of result set and query for more data when we call `moveToNext'
thanks

役に立ちましたか?

解決

Yes. It is a readonly copy of the DB.

他のヒント

From Android Developers:

This interface provides random read-write access to the result set returned by a database query. Cursor implementations are not required to be synchronized so code using a Cursor from multiple threads should perform its own synchronization when using the Cursor.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top