Android-SQLite数据库比较
有没有办法检查android SQLite DB是否已经更改 也可以在这种格式中使用: i、 eAndroid-SQLite数据库比较,android,sqlite,android-sqlite,Android,Sqlite,Android Sqlite,有没有办法检查android SQLite DB是否已经更改 也可以在这种格式中使用: i、 e 谢谢,我还没有找到任何API,但另一个选项是获取sqlite文件的MD5值,并与上一个MD5进行比较 一个简单的解决方案:您可以创建一个windows服务,或者只发布一个包含校验和的.xml文件3203025 您是指架构更改,如新表、列添加/删除吗?或者sqlite文件中的数据更改?看起来像是一个错误。什么是“变化”?你为什么要知道?答案因您的目标而异(即:检查架构更改、检查更新的作业队列、检查第
谢谢,我还没有找到任何API,但另一个选项是获取sqlite文件的MD5值,并与上一个MD5进行比较
一个简单的解决方案:您可以创建一个windows服务,或者只发布一个包含校验和的.xml文件
3203025
您是指架构更改,如新表、列添加/删除吗?或者sqlite文件中的数据更改?看起来像是一个错误。什么是“变化”?你为什么要知道?答案因您的目标而异(即:检查架构更改、检查更新的作业队列、检查第三方数据伪造)。@rutter正在尝试将本地android SQLite与在线MySQL同步。@Prakash任何更改数据更改都是新记录、已删除记录或已编辑记录
if (isChanged){
POST data
}else{
Log.i("no changes")
}
<?xml version="1.0" encoding="UTF-8"?>
<mobiledb>
<nombre>Stiri IASI</nombre>
<urlDB>http://jorgesys.com/appiphone/android/stiridb.db</urlDB>
<checksum>3203025</checksum>
</mobiledb>
//method readUrlDatabaseChecksum(), download and parse the currently value of checksum from the .xml file
String checksumDB = readUrlDatabaseChecksum();
//method readDBChecksum(), get the stored value (preferences or db) of the las checksum.
String lastDBChecksum = readDBChecksum(); //dbm.obtenerCheckSum(seccion.getId());;
//If the values are different proceed to download the new version of the Database.
if(!checksumFeed.equals(checksumDB)){
Log.i(TAG, "*** Downloading new Database!");
//method downloadDatabase(), download the new version of the database.
downloadDatabase();
//method saveDBChecksum(), save the new value (preferences or db) of the las checksum.
saveDBChecksum();
}else{
Log.i(TAG, "*** Database hasn´t changed!");
}