escaping in a non-prepared query

"Ronald Klop (Mailing List)" <[email protected]> Fri, 4 Nov 2011 13:22:19 +0100 (CET)
Newsgroups gmane.comp.db.mysql.java
Message-ID <1186877837.32.1320409339640.JavaMail.tomcat@localhost>
------=_Part_31_192950746.1320409339636
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

 In my application I have a query which is very hard to rewrite to a preparedstatement for legacy reasons. Is there some method so I can do the right escaping by hand?

 query = "SELECT * FROM foo WHERE bar = '" + MySQLUtils.escapeString("bla") + "'";

 Something like that.

 Thanks in advance,
 Ronald.
------=_Part_31_192950746.1320409339636--