PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ pgis_asgeobuf_transfn()

Datum pgis_asgeobuf_transfn ( PG_FUNCTION_ARGS  )

Definition at line 46 of file lwgeom_out_geobuf.c.

References geobuf_agg_init_context(), geobuf_agg_transfn(), geobuf_agg_context::geom_name, PG_FUNCTION_INFO_V1(), pgis_asgeobuf_finalfn(), and geobuf_agg_context::row.

47 {
48 #if ! (defined HAVE_LIBPROTOBUF && defined HAVE_GEOBUF)
49  elog(ERROR, "Missing libprotobuf-c >= version 1.1");
50  PG_RETURN_NULL();
51 #else
52  MemoryContext aggcontext;
53  struct geobuf_agg_context *ctx;
54 
55  if (!AggCheckCallContext(fcinfo, &aggcontext))
56  elog(ERROR, "pgis_asmvt_transfn: called in non-aggregate context");
57  MemoryContextSwitchTo(aggcontext);
58 
59  if (PG_ARGISNULL(0)) {
60  ctx = palloc(sizeof(*ctx));
61 
62  ctx->geom_name = NULL;
63  if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
64  ctx->geom_name = text_to_cstring(PG_GETARG_TEXT_P(2));
66  } else {
67  ctx = (struct geobuf_agg_context *) PG_GETARG_POINTER(0);
68  }
69 
70  if (!type_is_rowtype(get_fn_expr_argtype(fcinfo->flinfo, 1)))
71  elog(ERROR, "pgis_asgeobuf_transfn: parameter row cannot be other than a rowtype");
72  ctx->row = PG_GETARG_HEAPTUPLEHEADER(1);
73 
74  geobuf_agg_transfn(ctx);
75  PG_RETURN_POINTER(ctx);
76 #endif
77 }
HeapTupleHeader row
Definition: geobuf.h:52
void geobuf_agg_transfn(struct geobuf_agg_context *ctx)
Aggregation step.
Definition: geobuf.c:561
void geobuf_agg_init_context(struct geobuf_agg_context *ctx)
Initialize aggregation context.
Definition: geobuf.c:524
char * geom_name
Definition: geobuf.h:50
Here is the call graph for this function: