PDA

View Full Version : bug in oci_parse of OracleModule.java


frankisans
05-25-2011, 02:15 PM
oci_parse do a regex replace for change variable placeholder to "?" that changes the format of TO_CHAR and TO_DATE functions. For example TO_CHAR("DD/MM/YYYY HH24:MI:SS") will be changed to TO_CHAR("DD/MM/YYYY HH24??").

A quickly workaround is to replace :MI and :SS before the regex replace and then change again.

String query1 = query.replaceAll(":MI", "#wafo#MI");
String query2 = query1.replaceAll(":SS", "#wafo#SS");
String query3 = query2.replaceAll(":FF", "#wafo#FF");
String jdbcQuery = query3.replaceAll(regex, "?");
String jdbcQuery1 = jdbcQuery.replaceAll("#wafo#MI", ":MI");
String jdbcQuery2 = jdbcQuery1.replaceAll("#wafo#SS", ":SS");
String jdbcQuery3 = jdbcQuery2.replaceAll("#wafo#FF", ":FF");