Is there a Java equivalent to PHP's mysql_real_escape_string() ?
This is to escape SQL injection attempts before passing them to Statement.execute().
I know I can use PreparedStatement instead, but let's assume these are one shot statements so preparing them will result in lower performance. I've already changed the code to use PreparedStatement but given the way the existing code was structured, an escape() function would make the code changes much simpler to review and maintain; I prefer easy to maintain code unless there is a compelling reason for the extra complexity. Also PreparedStatements are handled differently by the database, so this could expose us to bugs in the database that we haven't run into before, requiring more testing before releasing to production.
Apache StringEscapeUtils escapeSQL() only escapes single quotes.