3

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?

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I can't seem to get this class to compile on eclipse by itself so I am trying to figure that out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.