突然被这个问题难到,
ContentValues values = new ContentValues();
values.put(Cards.WinCount,1);
db.update(Card_LIST_TABLE_NAME, values, where, whereArgs);
暂不使用rawQuery与先SELECT然后把原值读出来加1后再UPDATE的办法,用ContentValues 能实现吗?
求高手指点.
ContentValues values = new ContentValues();
values.put(Cards.WinCount,1);
db.update(Card_LIST_TABLE_NAME, values, where, whereArgs);
暂不使用rawQuery与先SELECT然后把原值读出来加1后再UPDATE的办法,用ContentValues 能实现吗?
求高手指点.
* Convenience method for updating rows in the database.
*
* @param table the table to update in
* @param values a map from column names to new column values. null is a
* valid value that will be translated to NULL.
* @param whereClause the optional WHERE clause to apply when updating.
* Passing null will update all rows.
* @return the number of rows affected
*/
public int update(String table, ContentValues values, String whereClause, String[] whereArgs) {
return updateWithOnConflict(table, values, whereClause, whereArgs, null);
}