简体   繁体   English

android sqlite在线更新,更新应用程序并影响用户输入的数据

[英]android sqlite update online with updating the app and affecting user inputted data

I using SQLite as my database. 我使用SQLite作为我的数据库。

Using the app, the user can save some item on the database. 使用该应用程序,用户可以在数据库中保存一些项目。

But I would like also to update the database from time to time. 但我还想不时更新数据库。

The problem is how can I update the database without affecting the user inserted data and in a manner that it will download the new database online and not by updating the app itself. 问题是如何在不影响用户插入数据的情况下更新数据库,以及在线下载新数据库而不是更新应用程序本身的方式。

Since my comment is large, I'll post it as an answer. 由于我的评论很大,我会将其作为答案发布。

You won't find any tutorial showing exactly what you're trying to accomplish, because what you need is somewhat complex (but not difficult) 您将找不到任何准确显示您要完成的内容的教程,因为您需要的内容有点复杂(但并不困难)

First approach: 第一种方法:

  1. You need your app to query some webservice to find out if there's a newer version of the database, and if there is, download it 您需要您的应用程序查询某些Web服务以查明是否有更新版本的数据库,如果有,请下载它

  2. The database must be saved in some temporary location, then you transfer all the users saved data to the new database, and finally replace the apps database with the new database (already updated with user's data) 数据库必须保存在一些临时位置,然后将所有用户保存的数据传输到新数据库,最后用新数据库替换apps数据库(已用用户数据更新)

Another approach would be: 另一种方法是:

  1. Make your app query some webservice to find if the database needs to be updated. 让您的应用程序查询一些Web服务,以查找是否需要更新数据库。

  2. If yes, download the SQL commands to modify the database structure. 如果是,请下载SQL命令以修改数据库结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM