On Fri, Sep 25, 2009 at 11:19 AM, Mark Murphy <[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to