android - Sqlite UPDATE with parameterised IN (...) clause -
this question has reply here:
in clause , placeholders 6 answersin app i'm working sqlite database - , nail unusual issue.
i have table looks this:
_id field1 field2 status --- ------ ------ ------ 1 value value ... 2 value value ... ...
at 1 place, need update rows set them status, 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 nil gets updated - , db.update
returns 0. missing?
i'm not happy recommending not using parameters, case, it's easier formatting ?
markers (and plain integers, safe):
db.update(table_orders, cv, "_id in (" + idparam + ")", null);
android sqlite sqlite3
No comments:
Post a Comment