PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ encode_keys()

static void encode_keys ( struct geobuf_agg_context ctx)
static

Definition at line 52 of file geobuf.c.

53 {
54  TupleDesc tupdesc = get_tuple_desc(ctx);
55  uint32_t natts = (uint32_t) tupdesc->natts;
56  char **keys = palloc(natts * sizeof(*keys));
57  uint32_t i, k = 0;
58  bool geom_found = false;
59  for (i = 0; i < natts; i++) {
60 #if POSTGIS_PGSQL_VERSION < 110
61  Oid typoid = getBaseType(tupdesc->attrs[i]->atttypid);
62  char *tkey = tupdesc->attrs[i]->attname.data;
63 #else
64  Oid typoid = getBaseType(tupdesc->attrs[i].atttypid);
65  char *tkey = tupdesc->attrs[i].attname.data;
66 #endif
67  char *key = pstrdup(tkey);
68  if (ctx->geom_name == NULL) {
69  if (!geom_found && typoid == postgis_oid(GEOMETRYOID)) {
70  ctx->geom_index = i;
71  geom_found = 1;
72  continue;
73  }
74  } else {
75  if (!geom_found && strcmp(key, ctx->geom_name) == 0) {
76  ctx->geom_index = i;
77  geom_found = 1;
78  continue;
79  }
80  }
81  keys[k++] = key;
82  }
83  if (!geom_found)
84  elog(ERROR, "encode_keys: no geometry column found");
85  ctx->data->n_keys = k;
86  ctx->data->keys = keys;
87  ReleaseTupleDesc(tupdesc);
88 }
static TupleDesc get_tuple_desc(struct geobuf_agg_context *ctx)
Definition: geobuf.c:44
uint32_t geom_index
Definition: geobuf.h:51
char * geom_name
Definition: geobuf.h:50
unsigned int uint32_t
Definition: uthash.h:78

References geobuf_agg_context::data, geobuf_agg_context::geom_index, geobuf_agg_context::geom_name, and get_tuple_desc().

Referenced by geobuf_agg_transfn().

Here is the call graph for this function:
Here is the caller graph for this function: