Hi,
I've been working a little on a simple visitor that can
be used to simplify a filter before trying to encode it
in an external representation (SQL, OGC filter).
This is useful since various filter manipulation code is
blindly and-ing/or-ing filters without taking care of
the obvious simplifications
(think Filter.INCLUDE or att = 5 --> Filter.INCLUDE),
resulting in SQL queries that look way less than ideal...
ever seen stuff like "WHERE (TRUE AND TRUE) AND blah='xxx'"?
Unfortunately I did, and I find it very annoying ;)
The class is SimplyfingFilterVisitor, I've added tests,
used it in the two sql encoders (FilterToSQL and SQLEncoder)
to simplify the filter before encoding, and made sure postgis,
oracle and mysql tests are still passing.
Yet, I haven't committed, for a couple of issues I hope
to solve with the help of the community:
* I cannot test DB2 and ArcSDE. If I commit is there anyone
able to run the tests? The encoded filter does not change,
but I've made so that if the simplification returns
Filter.INCLUDE, no where clause is created at all
('Select ... from ... where true' is just silly).
* Are the filter encoders the right place to perform the
simplification logic? For sure it's the minimal modification
giving the best overall usage of the algorithm, but
I'm wondering if the simplification is the duty of
the encoder, or of the class calling it.
I've checked, doing the simplification outside of the
encoders would result in a much larger patch and would
require me to touch code I'm not familiar with, yet
I would like to hear your opinion. If the other devs
prefer to see the simplification called in the caller
class I can just move the simplification calls into
JDBC1DataStore to cover the the jdbc classic case, that
would leave out ArcSDE and H2 thought.
Well, let me know
Cheers
Andrea
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel