문제

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