Reputation: 1814
Is this the correct way to delete rows with Multiple WHERE arguments? I am trying to make it as safe as I can to the database query.
db.delete(TABLE, NAME + "=? and " + ID + "=? and " + ARG3 + "=?", new String[] { myName, x, argument3 });
Also is it okay that ID is a integer? Can I still use it inside String[]
for this?
Upvotes: 3
Views: 1463
Reputation: 86948
Your method looks fine.
Also is it okay that ID is a integer? Can I still use it inside String[] for this?
Your compiler is the best way to answer this question.
However, if x
(for instance) is an Integer you can use either of these:
new String[] { x + "" };
new String[] { String.valueOf(x) };
If you are concern that ID
in "=? and " + ID + "=? and "
will give you an error, don't worry it won't.
Upvotes: 3