I have to execute the following query in Android SQLite
UPDATE player SET rank=rank+1 WHERE rank >= 3;
Here rank is the column name of INTEGER type.
I know about update method
update(tablename, values, whereClause, whereArgs);
I will pass player as first argument, rank >= 3 as 3rd argument and null as last argument but I am unable to find what to pass as 2nd argument. According to the docs it should be an object of ContentValues.
so I created its object as
ContentValues values = new ContentValues();
values.put("rank",?????);
I am confused about what to put the value for rank key which is a column in my table. Please suggest me what to pass as value to put() method of values
I believe update method is not One-Size-Fit-All method. So I think you need to use rawQuery() to achieve this kind of sql execution. for example:
or perhaps use execSQL as said by el7r