[android-developers] Re: Do Cursor s stay valid across database changes?
It makes a copy. This is how SQLite works. What things you need to observe is really dependent on your schema... and if this isn't behind a content provider, it is actually entirely up to you to tell your code when things change so you can do that however you want. On Wed, May 13, 2009 at 9:35 AM, Hamilton Turner < hamilton.a.tur...@vanderbilt.edu> wrote: > Marco, > Thanks for the reply. Do you happen to have a link to this being used? > > I though a cursor was similar to PHP's handle, meaning that it did not > retrieve the data until the data was actively requested, saving on all sorts > of things. So if I had a class with 5 cursors, all pointing to small bits of > data, do I need to have a DatasetObserver for every Cursor I have stored? > > Thanks, > Hamilton > > On May 13, 2009, at 10:29 AM, Marco Nelissen wrote: > > The Cursor holds a copy of the data, so it might be holding data that no > longer matches what's in the database. > Normally you'd use a ContentObserver or DatasetObserver with your cursor to > be notified when the cursor needs to be requeried. > > > On Wed, May 13, 2009 at 6:38 AM, Hamy wrote: > >> >> Hey All, >> >> I am looking to create objects that internally store a few cursors. >> When asked for data, those objects will use the cursors to get the >> data from the database. This is to hide my database structure from the >> rest of my app. >> >> My question is, if I get a cursor, and change the database with many >> insertions/updates/deletes, would the cursor still be pointing to the >> correct location? (Assuming I did not delete it's data) >> >> Thanks, >> Ham >> >> > > > > > > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Do Cursor s stay valid across database changes?
Marco, Thanks for the reply. Do you happen to have a link to this being used? I though a cursor was similar to PHP's handle, meaning that it did not retrieve the data until the data was actively requested, saving on all sorts of things. So if I had a class with 5 cursors, all pointing to small bits of data, do I need to have a DatasetObserver for every Cursor I have stored? Thanks, Hamilton On May 13, 2009, at 10:29 AM, Marco Nelissen wrote: > The Cursor holds a copy of the data, so it might be holding data > that no longer matches what's in the database. > Normally you'd use a ContentObserver or DatasetObserver with your > cursor to be notified when the cursor needs to be requeried. > > > On Wed, May 13, 2009 at 6:38 AM, Hamy wrote: > > Hey All, > > I am looking to create objects that internally store a few cursors. > When asked for data, those objects will use the cursors to get the > data from the database. This is to hide my database structure from the > rest of my app. > > My question is, if I get a cursor, and change the database with many > insertions/updates/deletes, would the cursor still be pointing to the > correct location? (Assuming I did not delete it's data) > > Thanks, > Ham > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Do Cursor s stay valid across database changes?
The Cursor holds a copy of the data, so it might be holding data that no longer matches what's in the database. Normally you'd use a ContentObserver or DatasetObserver with your cursor to be notified when the cursor needs to be requeried. On Wed, May 13, 2009 at 6:38 AM, Hamy wrote: > > Hey All, > > I am looking to create objects that internally store a few cursors. > When asked for data, those objects will use the cursors to get the > data from the database. This is to hide my database structure from the > rest of my app. > > My question is, if I get a cursor, and change the database with many > insertions/updates/deletes, would the cursor still be pointing to the > correct location? (Assuming I did not delete it's data) > > Thanks, > Ham > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---