有人可以建议我一种方法来更改已解析的JSON文件的内容时如何更新我的应用程序SQLite数据库吗?
我很难找到合适的解决方案,现在我必须在应用启动之前清除缓存,但是最终用户显然不会这样做。
我认为更改表版本不适合频繁更新(每小时)。
谢谢!
正如@KenWolf在评论中提到此文档。
更新数据库:
当您需要修改数据库值的子集时,请使用该update()
方法。
更新表格会将的内容值语法insert()
与的where语法结合在一起delete()
。
SQLiteDatabase db = mDbHelper.getWritableDatabase();
// New value for one column
ContentValues values = new ContentValues();
values.put(FeedEntry.COLUMN_NAME_TITLE, title);
// Which row to update, based on the title
String selection = FeedEntry.COLUMN_NAME_TITLE + " LIKE ?";
String[] selectionArgs = { "MyTitle" };
int count = db.update(
FeedReaderDbHelper.FeedEntry.TABLE_NAME,
values,
selection,
selectionArgs);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句