Skip to content

Commit

Permalink
Merge pull request #6713 from rouault/wfs_filter_quote
Browse files Browse the repository at this point in the history
WFS/CSW: do not remove single or double quote character in a LIKE filter
  • Loading branch information
rouault authored Nov 16, 2022
2 parents b9ef6b4 + a01d852 commit b549517
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ogr/ogrsf_frmts/wfs/ogrwfsfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ static bool WFS_ExprDumpAsOGCFilter( CPLString& osFilter,
poExpr->nOperation == SWQ_ILIKE )
{
CPLString osVal;
char firstCh = 0;
const char* pszMatchCase =
poExpr->nOperation == SWQ_LIKE &&
!CPLTestBool(CPLGetConfigOption("OGR_SQL_LIKE_AS_ILIKE", "FALSE")) ? "true" : "false";
Expand All @@ -319,23 +318,15 @@ static bool WFS_ExprDumpAsOGCFilter( CPLString& osFilter,

// Escape value according to above special characters. For URL
// compatibility reason, we remap the OGR SQL '%' wildcard into '*'.
int i = 0;
char ch = poExpr->papoSubExpr[1]->string_value[i];
if (ch == '\'' || ch == '"')
{
firstCh = ch;
i ++;
}
for(;(ch = poExpr->papoSubExpr[1]->string_value[i]) != '\0';i++)
char ch;
for(int i = 0;(ch = poExpr->papoSubExpr[1]->string_value[i]) != '\0';i++)
{
if (ch == '%')
osVal += "*";
else if (ch == '!')
osVal += "!!";
else if (ch == '*')
osVal += "!*";
else if (ch == firstCh && poExpr->papoSubExpr[1]->string_value[i + 1] == 0)
break;
else
{
char ach[2];
Expand Down

0 comments on commit b549517

Please sign in to comment.