
update() 此方法用来执行更新操作。用户可以在 ValuesBucket 参数中指定要更新的数据,在 DataAbilityPredicates 中构建更新的条件等。更新用户表的数据的代码示例如下:
public int update(Uri uri, ValuesBucket value, DataAbilityPredicates predicates) { if (ormContext == null) { HiLog.error(LABEL_LOG, “failed to update, ormContext is null”); return 返回-1; } OrmPredicates ormPredicates = DataAbilityUtils.createOrmPredicates(predicates,User.class); int index = ormContext.update(ormPredicates, value); HiLog.info(LABEL_LOG, “UserDataAbility update value:” + index); DataAbilityHelper.creator创造者(this, uri).notify通知Change(uri); return index; }
