Bulk Insertion on Android device

后端 未结 5 825
刺人心
刺人心 2020-11-28 02:40

I want to bulk insert about 700 records into the Android database on my next upgrade. What\'s the most efficient way to do this? From various posts, I know that if I use <

5条回答
  •  心在旅途
    2020-11-28 02:44

    I don't believe there is any feasible way to accomplish #3 or #4 on your list.

    Of the other solutions you list two that have the datafile contain direct SQL, and the other has the data in a non-SQL format.

    All three would work just fine, but the latter suggestion of grabbing the data from a formatted file and building the SQL yourself seems the cleanest. If true batch update capability is added at a later date your datafile is still usable, or at least easily processable into a usable form. Also, creation of the datafile is more straightforward and less error prone. Finally, having the "raw" data would allow import into other data-store formats.

    In any case, you should (as you mentioned) wrap the groups of inserts into transactions to avoid the per-row transaction journal creation.

提交回复
热议问题