Skip to content
Permalink
Browse files

Merge pull request #8816 from rldhont/sld-read-like-escapeChar-218

[BUGFIX] SLD : Support escapeChar attribute of PropertyIsLike
  • Loading branch information
rldhont committed Jan 9, 2019
2 parents 86ff500 + 0ab834e commit b411f36bca6a7a7c01a47755f3666461de2930e8
Showing with 11 additions and 1 deletion.
  1. +4 −0 src/core/qgsogcutils.cpp
  2. +7 −1 tests/src/core/testqgsogcutils.cpp
@@ -1808,6 +1808,10 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter(
{
escape = element.attribute( "escape" );
}
else if ( element.hasAttribute( "escapeChar" ) )
{
escape = element.attribute( "escapeChar" );
}
// replace
QString oprValue = static_cast<const QgsExpression::NodeLiteral*>( opRight )->value().toString();
if ( !wildCard.isEmpty() && wildCard != "%" )
@@ -330,13 +330,19 @@ void TestQgsOgcUtils::testExpressionFromOgcFilter_data()
"<PropertyName>NAME</PropertyName><Literal>._QGIS.\\.</Literal></PropertyIsLike>"
"</Filter>" )
<< QString( "NAME LIKE '_\\\\_QGIS_.'" );
// different single chars
// different escape chars
QTest::newRow( "like escape char" ) << QString(
"<Filter>"
"<PropertyIsLike wildCard=\"*\" singleChar=\".\" escape=\"!\">"
"<PropertyName>NAME</PropertyName><Literal>_QGIS.!.!!%QGIS*!*</Literal></PropertyIsLike>"
"</Filter>" )
<< QString( "NAME LIKE '\\\\_QGIS_.!\\\\%QGIS%*'" );
QTest::newRow( "like escape char" ) << QString(
"<Filter>"
"<PropertyIsLike wildCard=\"*\" singleChar=\".\" escapeChar=\"!\">"
"<PropertyName>NAME</PropertyName><Literal>_QGIS.!.!!%QGIS*!*</Literal></PropertyIsLike>"
"</Filter>" )
<< QString( "NAME LIKE '\\\\_QGIS_.!\\\\%QGIS%*'" );

QTest::newRow( "is null" ) << QString(
"<Filter>"

0 comments on commit b411f36

Please sign in to comment.
You can’t perform that action at this time.