db2 does not allow parameter markers in an sql function without a cast ----------------------------------------------------------------------
Key: GEOT-2212 URL: http://jira.codehaus.org/browse/GEOT-2212 Project: GeoTools Issue Type: Bug Components: data jdbc-ng Affects Versions: 2.5.2, 2.6-M0 Reporter: Christian Mueller The problem arises with GEOT-2187. The produced statement is SELECT count(*) FROM "geotools"."ft1" WHERE lower("stringProperty") = lower(?) The problem is that DB2 does not allow parameter markers as function arguments without a cast. I good idea would be to have a method in the Dialect void encodeJdbcParamAsSQLFunctionParam( typeInfo) { out.write("?"); } which could be overridden in the db2 dialect. The typeInfo could be a java class or the db type info. The correct statement is: SELECT count(*) FROM "geotools"."ft1" WHERE lower("stringProperty") = lower(cast (? as varchar(4096))) We had this situation already in all spatial functions, eg. "where db2gse.st_intersects(cast (? as blob(2g)), geom)=1" and not "where db2gse.st_intersects(?,geom)=1". The solution for spatial params was the method : public void prepareGeometryValue(Geometry g, int srid, Class binding, StringBuffer sql ) { sql.append( "?" ); } in the PreparedStatementSQLDialict class. This method is overridden by the db2 dialect. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel