This question already has an answer here:
- IN clause and placeholders 10 answers
In my app I'm working with sqlite database - and I hit a strange issue.
I have a table that looks like this:
_id field1 field2 status
--- ------ ------ ------
1 value value ...
2 value value ...
...
At one place, I need to update some rows to set them to another status, so I'm trying
SQLiteDatabase db = getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put("status", STATUS_SENT);
Set<Integer> ids = datasource.getCompletedIds();
String idparam = TextUtils.join(",", ids);
int cnt = db.update(TABLE_ORDERS, cv, "_id in (?)", new String[] { idparam });
Log.d("db", "updated " + cnt + " rows");
db.close();
However nothing gets updated - and db.update
returns 0. What am I missing?