Hi,
I'm having a hard time with this issue:
http://jira.codehaus.org/browse/GEOT-1798

To sum up, I have a project that's using the GeoTools classification
functions (the ones used to build thematic maps with intervals, 
quantiles and the like). Now, those functions are in turn using
aggregate functions like distinct and the like, which for JDBC
datastores are turned into a "select distinct(attribute) ..."
(optimization).

Now, the trouble is my attribute name is using mixed case and the
JDBCFEatureCollection is not escaping it with quotes, making postgis
break (select distinct(MyAttribute) does not work, whilst
seleect distinct("MyAttribute") would).

The trouble is, the only class that knows how to escape an attribute,
the sql encoder, is not available.

It's even a little more complex than this, since what I really need to
do is to properly encode an Expression. 
FeatureCollection.distict(Expression) could be called with a math
expression and the like, so I'd need the SQLEncoder abilitity to
proper encode it. Too bad:
* the SQLEncoder is not visible from JDBCFeatureCollection, which
   is using SQLBuilder instead
* the SQLEncoder does not allow for encoding just an Expression,
   pretends to encode a filter
* the SQLEncoder is deprecated (postgis is still using it thought)
   and the replacement (FilterToSql) does not share a common inteface,
   so I cannot expose them out of SQLBuilder anyways.

What it would be nice to have is the ability, from within 
JDCBFeatureCollection, do so something like:
mySqlBuilder.getEncoder().encode(expression)

and leave the encoder do all the proper sql building and escaping
as needed.

Unfortunately in order to do so I'd need to:
* change the SQLBuilder interface so that it could return the
   sql encoder
* create a new SQLFilterEncoder interface that sums up the
   common traits of SQLEncoder and FilterToSQL, and I'd have to
   add the ability to encode expressions only as well

All of this is no small change, and moreover, I need a fix on
2.4.x, and quickly too.

Does anyone have any suggestion on how to handle this one without
having the project cost and deadline skyrocket?

Cheers
Andrea


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to