装入大量的数据到数据库 - Android电子 [英] Load large amount of data to DB - Android

查看:155
本文介绍了装入大量的数据到数据库 - Android电子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个新的应用程序到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?

两种方式我想:


  1. 保存所有数据,然后用的DocumentBuilder对象加载它的XML文件。

  2. 一个CSV文件,并用字符串标记加载它。研究发现,<一个href=\"http://stackoverflow.com/questions/6465696/inserting-large-amount-of-data-into-android-sqlite-database\">post.

  1. An xml file that holds all the data and then loads it with DocumentBuilder object.
  2. 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

这篇关于装入大量的数据到数据库 - Android电子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆