75 FuncCallContext *funcctx;
80 MemoryContext oldcontext, newcontext;
87 if (SRF_IS_FIRSTCALL())
89 funcctx = SRF_FIRSTCALL_INIT();
90 newcontext = funcctx->multi_call_memory_ctx;
92 oldcontext = MemoryContextSwitchTo(newcontext);
94 pglwgeom = PG_GETARG_GSERIALIZED_P_COPY(0);
113 funcctx->user_fctx = state;
119 get_call_result_type(fcinfo, 0, &tupdesc);
120 BlessTupleDesc(tupdesc);
126 funcctx->attinmeta = TupleDescGetAttInMetadata(tupdesc);;
128 MemoryContextSwitchTo(oldcontext);
132 funcctx = SRF_PERCALL_SETUP();
133 newcontext = funcctx->multi_call_memory_ctx;
136 state = funcctx->user_fctx;
139 if ( ! state->
root ) SRF_RETURN_DONE(funcctx);
146 tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
147 result = HeapTupleGetDatum(tuple);
150 SRF_RETURN_NEXT(funcctx,
result);
168 if ( i ) ptr += sprintf(ptr,
",");
169 ptr += sprintf(ptr,
"%d", state->
stack[i]->
idx+1);
184 elog(ERROR,
"Unable to dump overly nested collection.");
186 oldcontext = MemoryContextSwitchTo(newcontext);
193 MemoryContextSwitchTo(oldcontext);
198 if ( !
POP(state) ) SRF_RETURN_DONE(funcctx);
206 tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
207 result = TupleGetDatum(funcctx->slot, tuple);
209 SRF_RETURN_NEXT(funcctx,
result);
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
char * lwgeom_to_hexwkb_buffer(const LWGEOM *geom, uint8_t variant)
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
void * lwalloc(size_t size)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
GEOMDUMPNODE * stack[MAXDEPTH]