Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing '$' when parsing ogc:PropertyIsLike ? #5825

Closed
pmauduit opened this issue Jun 21, 2019 · 1 comment

Comments

@pmauduit
Copy link
Contributor

commented Jun 21, 2019

When a regex is generated from a ogc:propertyIsLike filter, a '^' is prepended to the search, but we cannot find the line end ('$').

For example, with the following snippet in our SLD:

<ogc:PropertyIsLike escapeChar="\" matchCase="false" singleChar="?" wildCard="*">
  <ogc:PropertyName>PROGRAMMES</ogc:PropertyName>
  <ogc:Literal>REPHYTOX</ogc:Literal>
</ogc:PropertyIsLike>

The corresponding SQL statement is generated:

REGEXP_LIKE( PROGRAMMES, '^REPHYTOX','i' ) 

If a '^' is appended, why isn't there also a '$' added at the end of the pattern ?

One would have expected the following:

REGEXP_LIKE( PROGRAMMES, '^REPHYTOX$','i' ) 

The '^' seems to be added in this code:
https://github.com/mapserver/mapserver/blob/master/mapogcfiltercommon.c#L100-L103

This might be related to this previous work: #5739

@rouault rouault closed this in eea166a Jun 24, 2019

rouault added a commit that referenced this issue Jun 24, 2019

Merge pull request #5826 from rouault/fix_5825
FLTGetIsLikeComparisonCommonExpression(): add terminating '$' at end of regular expression (fixes #5825)

backporting bot pushed a commit that referenced this issue Jun 24, 2019

rouault added a commit that referenced this issue Jun 24, 2019

Merge pull request #5829 from mapserver/backport-5826-to-branch-7-4
[Backport branch-7-4] FLTGetIsLikeComparisonCommonExpression(): add terminating '$' at end of regular expression (fixes #5825)
@geographika

This comment has been minimized.

Copy link
Member

commented Jul 26, 2019

@rouault - the commit at eea166a which adds the $ character causes an issue in the mssql driver (and possibly others database drivers?).

The SQL clause generated by the filter is now:

WHERE ((LOWER([OwnerName]) LIKE LOWER('%Unknown%$')))

Which returns no results due to the $

rouault added a commit to rouault/mapserver that referenced this issue Jul 26, 2019

geographika added a commit that referenced this issue Jul 30, 2019

MSSQL2008: deal with termination '$' at end of regular expression. Fo…
…llow-up of eea166a (refs #5825) (#5841)

Tested and confirm this fixes the issue

rouault added a commit that referenced this issue Jul 30, 2019

MSSQL2008: deal with termination '$' at end of regular expression. Fo…
…llow-up of eea166a (refs #5825) (#5841)

Tested and confirm this fixes the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.