I have the following code in an Update method of a ContentProvider subclass:
When I use placeholders for the Where clause, my update does not work (count equals 0):
Does not work:
rowID = uri.getPathSegments().get(1);
whereStr = "?=?";
count = db.update(PathSQLTable.TABLE_NAME, values, whereStr, new String[]{PathSQLTable.ID_KEY,rowID});
But if I do the substituion manually, everything works fine.
This works:
rowID = uri.getPathSegments().get(1);
whereStr = PathSQLTable.ID_KEY + "=" + rowID;
count = db.update(PathSQLTable.TABLE_NAME, values, whereStr, null);
My Question is— is there a bug in the placeholder logic (as suggested in this post) or am I doing something wrong?
it works only with the input parameters in the sql query, not with the columns name. So it should work if you try this: