我希望连接到 URL 并下载文件 (.db),如果它是更高版本,则更新应用程序上的数据库。例如当前使用Database1.db,此在线数据库是Database2.db。但是我不太确定该怎么做。我正在使用 sqlite。
谢谢
最佳答案
从服务器端:
Instead of uploading database from url you can post xml or json data which will give details bout database version and sql query
来自 Android 程序
connect to url get the data check for the version if version from url is higher than that of existing one then execute the sql query that you got to create database and take backup of your data
场景
Lets consider one scenario you have some data in a table named y in old database. but the new database which you are downloading doesn't have that y table but it has some new table then what do you want to perform with that data. Do you want to discard or store if store and use then to where you want to store.
关于java - 如何通过连接到远程位置来更新 Android 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8679154/