PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ parse_column_keys()

static void parse_column_keys ( struct mvt_agg_context ctx)
static

Definition at line 304 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().

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