MCPcopy Create free account
hub / github.com/MapServer/MapServer / FLTGetIsLikeComparisonCommonExpression

Function FLTGetIsLikeComparisonCommonExpression

mapogcfiltercommon.c:94–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94char *FLTGetIsLikeComparisonCommonExpression(FilterEncodingNode *psFilterNode)
95{
96 const size_t bufferSize = 1024;
97 char szBuffer[1024];
98 char szTmp[256];
99 char *pszValue = NULL;
100
101 char *pszWild = NULL;
102 char *pszSingle = NULL;
103 char *pszEscape = NULL;
104 int bCaseInsensitive = 0;
105
106 int nLength=0, i=0, iTmp=0;
107
108
109 if (!psFilterNode || !psFilterNode->pOther || !psFilterNode->psLeftNode ||
110 !psFilterNode->psRightNode || !psFilterNode->psRightNode->pszValue)
111 return NULL;
112
113 pszWild = ((FEPropertyIsLike *)psFilterNode->pOther)->pszWildCard;
114 pszSingle = ((FEPropertyIsLike *)psFilterNode->pOther)->pszSingleChar;
115 pszEscape = ((FEPropertyIsLike *)psFilterNode->pOther)->pszEscapeChar;
116 bCaseInsensitive = ((FEPropertyIsLike *)psFilterNode->pOther)->bCaseInsensitive;
117
118 if (!pszWild || strlen(pszWild) == 0 ||
119 !pszSingle || strlen(pszSingle) == 0 ||
120 !pszEscape || strlen(pszEscape) == 0)
121 return NULL;
122
123
124/* -------------------------------------------------------------------- */
125/* Use operand with regular expressions. */
126/* -------------------------------------------------------------------- */
127 szBuffer[0] = '\0';
128 sprintf(szTmp, "%s", " (\"[");
129 szTmp[4] = '\0';
130
131 strlcat(szBuffer, szTmp, bufferSize);
132
133 /* attribute */
134 strlcat(szBuffer, psFilterNode->psLeftNode->pszValue, bufferSize);
135 szBuffer[strlen(szBuffer)] = '\0';
136
137 /*#3521 */
138 if(bCaseInsensitive == 1)
139 sprintf(szTmp, "%s", "]\" ~* \"");
140 else
141 sprintf(szTmp, "%s", "]\" ~ \"");
142 szTmp[7] = '\0';
143 strlcat(szBuffer, szTmp, bufferSize);
144 szBuffer[strlen(szBuffer)] = '\0';
145
146
147 pszValue = psFilterNode->psRightNode->pszValue;
148 nLength = strlen(pszValue);
149
150 iTmp =0;
151 if (nLength > 0 && pszValue[0] != pszWild[0] &&

Callers 1

FLTGetCommonExpressionFunction · 0.85

Calls 2

strlcatFunction · 0.85
msStrdupFunction · 0.85

Tested by

no test coverage detected