MCPcopy Index your code
hub / github.com/MapServer/MapServer / FLTGetIsLikeComparisonExpression

Function FLTGetIsLikeComparisonExpression

mapogcfilter.c:2825–2927  ·  view source on GitHub ↗

/ FLTGetIsLikeComparisonExpression */ / Build expression for IsLike filter. */ /

Source from the content-addressed store, hash-verified

2823/* Build expression for IsLike filter. */
2824/************************************************************************/
2825char *FLTGetIsLikeComparisonExpression(FilterEncodingNode *psFilterNode)
2826{
2827 const size_t bufferSize = 1024;
2828 char szBuffer[1024];
2829 char szTmp[256];
2830 char *pszValue = NULL;
2831
2832 char *pszWild = NULL;
2833 char *pszSingle = NULL;
2834 char *pszEscape = NULL;
2835 int bCaseInsensitive = 0;
2836
2837 int nLength=0, i=0, iTmp=0;
2838
2839
2840 if (!psFilterNode || !psFilterNode->pOther || !psFilterNode->psLeftNode ||
2841 !psFilterNode->psRightNode || !psFilterNode->psRightNode->pszValue)
2842 return NULL;
2843
2844 pszWild = ((FEPropertyIsLike *)psFilterNode->pOther)->pszWildCard;
2845 pszSingle = ((FEPropertyIsLike *)psFilterNode->pOther)->pszSingleChar;
2846 pszEscape = ((FEPropertyIsLike *)psFilterNode->pOther)->pszEscapeChar;
2847 bCaseInsensitive = ((FEPropertyIsLike *)psFilterNode->pOther)->bCaseInsensitive;
2848
2849 if (!pszWild || strlen(pszWild) == 0 ||
2850 !pszSingle || strlen(pszSingle) == 0 ||
2851 !pszEscape || strlen(pszEscape) == 0)
2852 return NULL;
2853
2854
2855/* -------------------------------------------------------------------- */
2856/* Use operand with regular expressions. */
2857/* -------------------------------------------------------------------- */
2858 szBuffer[0] = '\0';
2859 sprintf(szTmp, "%s", " (\"[");
2860 szTmp[4] = '\0';
2861
2862 strlcat(szBuffer, szTmp, bufferSize);
2863
2864 /* attribute */
2865 strlcat(szBuffer, psFilterNode->psLeftNode->pszValue, bufferSize);
2866 szBuffer[strlen(szBuffer)] = '\0';
2867
2868 /*#3521 */
2869 if(bCaseInsensitive == 1)
2870 sprintf(szTmp, "%s", "]\" ~* /");
2871 else
2872 sprintf(szTmp, "%s", "]\" =~ /");
2873 szTmp[7] = '\0';
2874 strlcat(szBuffer, szTmp, bufferSize);
2875 szBuffer[strlen(szBuffer)] = '\0';
2876
2877
2878 pszValue = psFilterNode->psRightNode->pszValue;
2879 nLength = strlen(pszValue);
2880
2881 iTmp =0;
2882 if (nLength > 0 && pszValue[0] != pszWild[0] &&

Callers 2

FLTGetNodeExpressionFunction · 0.85

Calls 2

strlcatFunction · 0.85
msStrdupFunction · 0.85

Tested by

no test coverage detected