PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ parse_column_keys()

static void parse_column_keys ( mvt_agg_context ctx)
static

Definition at line 305 of file mvt.c.

References add_key(), mvt_agg_context::geom_index, mvt_agg_context::geom_name, and get_tuple_desc().

Referenced by mvt_agg_transfn().

306 {
307  TupleDesc tupdesc = get_tuple_desc(ctx);
308  uint32_t natts = (uint32_t) tupdesc->natts;
309  uint32_t i;
310  bool geom_found = false;
311  char *key;
312  POSTGIS_DEBUG(2, "parse_column_keys called");
313 
314  for (i = 0; i < natts; i++) {
315 #if POSTGIS_PGSQL_VERSION < 110
316  Oid typoid = getBaseType(tupdesc->attrs[i]->atttypid);
317  char *tkey = tupdesc->attrs[i]->attname.data;
318 #else
319  Oid typoid = getBaseType(tupdesc->attrs[i].atttypid);
320  char *tkey = tupdesc->attrs[i].attname.data;
321 #endif
322 #if POSTGIS_PGSQL_VERSION >= 94
323  if (typoid == JSONBOID)
324  continue;
325 #endif
326  key = pstrdup(tkey);
327  if (ctx->geom_name == NULL) {
328  if (!geom_found && typoid == TypenameGetTypid("geometry")) {
329  ctx->geom_index = i;
330  geom_found = true;
331  continue;
332  }
333  } else {
334  if (!geom_found && strcmp(key, ctx->geom_name) == 0) {
335  ctx->geom_index = i;
336  geom_found = true;
337  continue;
338  }
339  }
340  add_key(ctx, key);
341  }
342  if (!geom_found)
343  elog(ERROR, "parse_column_keys: no geometry column found");
344  ReleaseTupleDesc(tupdesc);
345 }
char * geom_name
Definition: mvt.h:52
static uint32_t add_key(mvt_agg_context *ctx, char *name)
Definition: mvt.c:294
unsigned int uint32_t
Definition: uthash.h:78
static TupleDesc get_tuple_desc(mvt_agg_context *ctx)
Definition: mvt.c:276
uint32_t geom_index
Definition: mvt.h:53
Here is the call graph for this function:
Here is the caller graph for this function: