SLD against Oracle is broken in 5.0

Bart van den Eijnden bartvde at GMAIL.COM
Wed Dec 5 06:36:59 EST 2007


Hi list,

SLD support against Oracle is broken in MS 5.0 unfortunately. We've been
debugging the whole morning and have identified the following problems in
the source code (mapogcfilter.c):

1) the classes created by mapogcsld.c are destroyed because of the following
call:

line 919:
initClass(lp->class[0]);

the code already has a comment like which indicates this could be a problem:

    /* TODO: Doesn't this code leak the contents of any pre-existing class
     * in the layer???
     */

2) the if clause in FLTLayerApplyCondSQLFilterToLayer never gets entered
since bOnlySpatialFilter is always true (it is passed in as MS_TRUE always
in the caller function, i.e. return FLTApplyFilterToLayer(psNode, map,
iLayerIndex, MS_TRUE);)

This means Mapserver always evaluates the query, which is very slow for
Oracle, instead of adding a WHERE to the SQL using FILTER. For now we just
changed the if clause:

if (!bOnlySpatialFilter && FLTIsSimpleFilter(psNode))

to:

if (FLTIsSimpleFilter(psNode))

but someone should look at this more carefully I guess ....

3) it's better to always use parantheses around the FILTER, since otherwise
OR and AND won't work correctly as intended, so change line 929 from:

        else //POSTGIS OR ORACLE if (lp->connectiontype == MS_POSTGIS)
          sprintf(pszBuffer, "%s", szExpression);

to

        else //POSTGIS OR ORACLE if (lp->connectiontype == MS_POSTGIS)
          sprintf(pszBuffer, "(%s)", szExpression);

Hope this helps.

Best regards,
Bart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20071205/2e579134/attachment.html


More information about the mapserver-dev mailing list