100 uint32_t *properties;
101 Data__Value **values;
102 uint32_t i, k = 0, c = 0;
104 uint32_t natts = (uint32_t) tupdesc->natts;
105 properties = palloc(
sizeof (*properties) * (natts - 1) * 2);
106 values = palloc (
sizeof (*values) * (natts - 1));
108 for (i = 0; i < natts; i++) {
110 char *
type, *string_value;
120 data__value__init(
value);
122 type = SPI_gettype(tupdesc, i + 1);
123 datum = GetAttributeByNum(ctx->
row, i + 1, &isnull);
127 typoid = getBaseType(TupleDescAttr(tupdesc, i)->atttypid);
129 if (strcmp(
type,
"int2") == 0) {
131 }
else if (strcmp(
type,
"int4") == 0) {
133 }
else if (strcmp(
type,
"int8") == 0) {
135 }
else if (strcmp(
type,
"float4") == 0) {
136 value->value_type_case = DATA__VALUE__VALUE_TYPE_DOUBLE_VALUE;
137 value->double_value = DatumGetFloat4(datum);
138 }
else if (strcmp(
type,
"float8") == 0) {
139 value->value_type_case = DATA__VALUE__VALUE_TYPE_DOUBLE_VALUE;
140 value->double_value = DatumGetFloat8(datum);
144 getTypeOutputInfo(typoid, &foutoid, &typisvarlena);
145 string_value = OidOutputFunctionCall(foutoid, datum);
146 value->value_type_case = DATA__VALUE__VALUE_TYPE_STRING_VALUE;
147 value->string_value = string_value;
149 properties[c * 2] = k - 1;
150 properties[c * 2 + 1] = c;
154 ReleaseTupleDesc(tupdesc);
156 feature->n_values = c;
157 feature->values = values;
158 feature->n_properties = c * 2;
159 feature->properties = properties;
static TupleDesc get_tuple_desc(struct geobuf_agg_context *ctx)
static void set_int_value(Data__Value *value, int64 intval)