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

Function FLTGetBinaryComparisonCommonExpression

mapogcfiltercommon.c:326–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326char *FLTGetBinaryComparisonCommonExpression(FilterEncodingNode *psFilterNode, layerObj *lp)
327{
328 char szTmp[1024];
329 char *pszExpression = NULL;
330 int bString;
331
332 if (psFilterNode == NULL)
333 return NULL;
334
335/* -------------------------------------------------------------------- */
336/* check if the value is a numeric value or alphanumeric. If it */
337/* is alphanumeric, add quotes around attribute and values. */
338/* -------------------------------------------------------------------- */
339 bString = 0;
340 if (psFilterNode->psRightNode->pszValue)
341 {
342 snprintf(szTmp, sizeof(szTmp), "%s_type", psFilterNode->psLeftNode->pszValue);
343 if (msOWSLookupMetadata(&(lp->metadata), "OFG", szTmp) != NULL &&
344 (strcasecmp(msOWSLookupMetadata(&(lp->metadata), "G", szTmp), "Character") == 0))
345 bString = 1;
346 else if (FLTIsNumeric(psFilterNode->psRightNode->pszValue) == MS_FALSE)
347 bString = 1;
348 }
349
350 /* specical case to be able to have empty strings in the expression. */
351 /*propertyislike is always treated as string*/
352 if (psFilterNode->psRightNode->pszValue == NULL ||
353 strcasecmp(psFilterNode->pszValue, "PropertyIsLike") == 0)
354 bString = 1;
355
356
357
358 /* attribute */
359 if (bString)
360 sprintf(szTmp, "%s", " (\"[");
361 else
362 sprintf(szTmp, "%s"," ([");
363 pszExpression = msStringConcatenate(pszExpression, szTmp);
364 pszExpression = msStringConcatenate(pszExpression, psFilterNode->psLeftNode->pszValue);
365 if (bString)
366 sprintf(szTmp, "%s","]\" ");
367 else
368 sprintf(szTmp, "%s", "] ");
369 pszExpression = msStringConcatenate(pszExpression, szTmp);
370
371 if (strcasecmp(psFilterNode->pszValue,
372 "PropertyIsEqualTo") == 0)
373 {
374 /*case insensitive set ? */
375 if (psFilterNode->psRightNode->pOther &&
376 (*(int *)psFilterNode->psRightNode->pOther) == 1)
377 {
378 sprintf(szTmp, "%s", "=*");
379 }
380 else
381 sprintf(szTmp, "%s", "=");
382
383 }

Callers 1

FLTGetCommonExpressionFunction · 0.85

Calls 4

msOWSLookupMetadataFunction · 0.85
strcasecmpFunction · 0.85
FLTIsNumericFunction · 0.85
msStringConcatenateFunction · 0.85

Tested by

no test coverage detected