Hi Marco, I am not implementing a content provider. Btw, I found out that by not calling getWriteableDatabase every single insert noticeably improves db insertion speed.
Agus. On Sat, Sep 26, 2009 at 1:37 PM, Marco Nelissen <marc...@android.com> wrote: > > On Fri, Sep 25, 2009 at 11:19 AM, Mark Murphy <mmur...@commonsware.com> > wrote: > > > >> Also, "batch insert" generally means you insert multiple items at > >> once, so you should only need to do one call to bulkInsert(), and > >> hence one call to getWriteableDatabase. > > > > bulkInsert() is only for content providers; it is not implemented on > > SQLiteDatabase. > > True. It wasn't entirely clear to me whether the original poster was > using/implementing a content provider or not. > > > If there is a way to do a bulk insert in SQLite, without bulkInsert(), > I'd > > be interested to know -- thanks! > > bulkInsert exists for content providers so you can avoid having an > inter process roundtrip for each insert. If you're handling your own > database, you don't really need it, but would do something like: > - get database > - begin transaction > - insert multiple items > - end transaction > > That's what most of the content providers do when you call bulkInsert. > There really is no need to get the database N times when you want to > insert N items. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---