装入大量的数据到数据库 - Android电子数据库、数据、电子、Android

2023-09-06 16:18:33 作者:睫毛下的琥珀

我建立一个新的应用程序到Android平台,我需要一个建议。我有大量的数据,我想导入到一个SQLite数据库,像2000行。我的问题是什么是将数据加载到数据库?

I'm building a new application to the Android platform and I need a suggestion. I have a large amount of data that I want to import into a sqlite DB, something like 2000 rows. My question is what is the best method to load the data into the DB?

两种方式我想:

保存所有数据,然后用的DocumentBuilder对象加载它的XML文件。一个CSV文件,并用字符串标记加载它。研究发现,post. An xml file that holds all the data and then loads it with DocumentBuilder object. A CSV file, and loads it with String Tokenizer. Found that post.

我想这是一个具有外部文件,因为当我发布一个更新,我将只替换该文件。

I want it to be with external file because When I release an update I will replace only the that file.

我想要的东西,这将是有效的,尽可能 - 所有数据都将在应用程序首次启动加载,我需要它要快

I want something that would be efficient as much as possible - all the data will load at the first startup of the application and I need it to be fast.

任何建议将是巨大的。谢谢你。

Any suggestion would be great. Thanks.

推荐答案

使用的 InsertHelper 的做批量插入。就以

Use InsertHelper to do a bulk insert. Take a look on this other question

 
精彩推荐
图片推荐