really...? That's surprising. I thought the moveToNext just fetches the rows lazily, fetches them when necessary.
On May 20, 2:15 pm, Marco Nelissen <[email protected]> wrote: > The first call to moveToNext() is still going to cause getCount() and > thus fillWindow() to be called internally, so it won't be any faster. > > On Wed, May 20, 2009 at 10:58 AM, Streets Of Boston > > > > <[email protected]> wrote: > > > In your example, it seems you don't need the getCount() or moveToFirst > > () at all. > > > The snippet below works well without using getCount or moveToFirst(). > > [code] > > Cursor c = db.query(var1, var2, var3 .....); > > while (c.moveToNext()) { > > // do something with cursor c > > ... > > } > > [/code] > > > On May 18, 10:47 am, Sublimity Mobile Software > > <[email protected]> wrote: > >> Hi, > > >> Currently i'm working on a database system for some applications. I > >> need to do a lot of queries to load data from the database into the > >> application. After being amazed how much time it took to do these > >> queries on the database i found out that much time was consumed by > >> cursor.MoveToFirst(). This functions costs currently ~25% of all my > >> database action. > > >> Does anyone know why this takes would take so long or does anyone know > >> a better solution to get to the first position of the cursor? > > >> My code: > > >> Cursor c = db.query(var1, var2, var3 .....); > >> c.CustomMoveToFirst(); > > >> int count = c.getCount(); > >> for(int i = 0; i<count; i++){ > >> doSomethingWithCursor(); > >> c.moveToNext(); > > >> } > > >> The same problem occurs when i place everything in a while loop and > >> use only the MoveToNext() function. So i think that the problem must > >> be in positioning the cursor to the first position. > > >> My code: > >> Cursor c = db.query(var1, var2, var3 .....); > >> c.CustomMoveToFirst(); > > >> while(c.moveToNext()){ > >> doSomethingWithCursor(); > > >> } > > >> Thanks, > >> Sublimity Mobile Software- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

