PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ pgis_geometry_clusterwithin_finalfn()

Datum pgis_geometry_clusterwithin_finalfn ( PG_FUNCTION_ARGS  )

Definition at line 354 of file lwgeom_accum.c.

References cluster_within_distance_garray(), pgis_abs::data, pgis_accum_finalfn(), and PGISDirectFunctionCall2().

Referenced by pgis_geometry_clusterintersecting_finalfn().

355 {
356  pgis_abs *p;
357  Datum result = 0;
358  Datum geometry_array = 0;
359 
360  if (PG_ARGISNULL(0))
361  PG_RETURN_NULL();
362 
363  p = (pgis_abs*) PG_GETARG_POINTER(0);
364 
365  if (!p->data)
366  {
367  elog(ERROR, "Tolerance not defined");
368  PG_RETURN_NULL();
369  }
370 
371  geometry_array = pgis_accum_finalfn(p, CurrentMemoryContext, fcinfo);
372  result = PGISDirectFunctionCall2( cluster_within_distance_garray, geometry_array, p->data);
373  if (!result)
374  PG_RETURN_NULL();
375 
376  PG_RETURN_DATUM(result);
377 }
Datum pgis_accum_finalfn(pgis_abs *p, MemoryContext mctx, FunctionCallInfo fcinfo)
The final function rescues the built array from the side memory context using the PostgreSQL built-in...
Definition: lwgeom_accum.c:182
Datum data
Definition: lwgeom_accum.c:86
Datum cluster_within_distance_garray(PG_FUNCTION_ARGS)
Datum PGISDirectFunctionCall2(PGFunction func, Datum arg1, Datum arg2)
A modified version of PostgreSQL's DirectFunctionCall2 which allows NULL results; this is required fo...
Definition: lwgeom_accum.c:428
To pass the internal ArrayBuildState pointer between the transfn and finalfn we need to wrap it into ...
Definition: lwgeom_accum.c:83
Here is the call graph for this function:
Here is the caller graph for this function: