PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ PGISDirectFunctionCall2()

Datum PGISDirectFunctionCall2 ( PGFunction  func,
Datum  arg1,
Datum  arg2 
)

A modified version of PostgreSQL's DirectFunctionCall2 which allows NULL results; this is required for aggregates that return NULL.

Definition at line 428 of file lwgeom_accum.c.

Referenced by pgis_geometry_clusterwithin_finalfn().

429 {
430 #if POSTGIS_PGSQL_VERSION < 120
431  FunctionCallInfoData fcinfo;
432  Datum result;
433 
434  InitFunctionCallInfoData(fcinfo, NULL, 2, InvalidOid, NULL, NULL);
435 
436  fcinfo.arg[0] = arg1;
437  fcinfo.arg[1] = arg2;
438  fcinfo.argnull[0] = false;
439  fcinfo.argnull[1] = false;
440 
441  result = (*func) (&fcinfo);
442 
443  /* Check for null result, returning a "NULL" Datum if indicated */
444  if (fcinfo.isnull)
445  return (Datum) 0;
446 
447  return result;
448 #else
449  LOCAL_FCINFO(fcinfo, 2);
450  Datum result;
451 
452  InitFunctionCallInfoData(*fcinfo, NULL, 2, InvalidOid, NULL, NULL);
453 
454  fcinfo->args[0].value = arg1;
455  fcinfo->args[1].value = arg2;
456  fcinfo->args[0].isnull = false;
457  fcinfo->args[1].isnull = false;
458 
459  result = (*func)(fcinfo);
460 
461  /* Check for null result, returning a "NULL" Datum if indicated */
462  if (fcinfo->isnull)
463  return (Datum)0;
464 
465  return result;
466 #endif /* POSTGIS_PGSQL_VERSION < 120 */
467 }
Here is the caller graph for this function: