简体   繁体   English

更新sqlite数据的最佳做法是什么?

[英]What are the best practices for updating sqlite data?

My application does not use internet, though I am using php(json) to get certain data from a local mysql database and parse the JSONObject to Java and save it to sqlite in Android. 我的应用程序不使用互联网,尽管我正在使用php(json)从本地mysql数据库获取某些数据,并将JSONObject解析为Java,然后保存到Android的sqlite中。

I am using this to dynamically populate my android menus from the mysql data(local database). 我正在使用它从mysql数据(本地数据库)动态填充我的android菜单。 I think this call for a better practice when it comes in getting updates in the database. 我认为在数据库中获取更新时,这是一种更好的做法。 I will be deleting the previous menu in my sqlite and fetch another data from mysql. 我将删除sqlite中的上一个菜单,然后从mysql获取另一个数据。

What I did since I want to update my sqlite database, I incremeted my database version if there are new updated. 自从我想更新我的sqlite数据库以来所做的事情,如果有新的更新,我会增加我的数据库版本。 Also I put an indicator from my outside database so that my app can check if there are available updates. 另外,我在外部数据库中放置了一个指示器,以便我的应用可以检查是否有可用的更新。

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

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