PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ encode_keys()

static void encode_keys ( struct geobuf_agg_context ctx)
static

Definition at line 53 of file geobuf.c.

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

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: