100 Data__Value **values;
101 uint32_t i, k = 0, c = 0;
103 uint32_t natts = (uint32_t) tupdesc->natts;
104 properties = palloc(
sizeof (*properties) * (natts - 1) * 2);
105 values = palloc (
sizeof (*values) * (natts - 1));
107 for (i = 0; i < natts; i++) {
109 char *
type, *string_value;
119 data__value__init(
value);
121 type = SPI_gettype(tupdesc, i + 1);
122 datum = GetAttributeByNum(ctx->
row, i + 1, &isnull);
126 typoid = getBaseType(TupleDescAttr(tupdesc, i)->atttypid);
128 if (strcmp(
type,
"int2") == 0) {
130 }
else if (strcmp(
type,
"int4") == 0) {
132 }
else if (strcmp(
type,
"int8") == 0) {
134 }
else if (strcmp(
type,
"float4") == 0) {
135 value->value_type_case = DATA__VALUE__VALUE_TYPE_DOUBLE_VALUE;
136 value->double_value = DatumGetFloat4(datum);
137 }
else if (strcmp(
type,
"float8") == 0) {
138 value->value_type_case = DATA__VALUE__VALUE_TYPE_DOUBLE_VALUE;
139 value->double_value = DatumGetFloat8(datum);
143 getTypeOutputInfo(typoid, &foutoid, &typisvarlena);
144 string_value = OidOutputFunctionCall(foutoid, datum);
145 value->value_type_case = DATA__VALUE__VALUE_TYPE_STRING_VALUE;
146 value->string_value = string_value;
148 properties[c * 2] = k - 1;
149 properties[c * 2 + 1] = c;
153 ReleaseTupleDesc(tupdesc);
155 feature->n_values = c;
156 feature->values = values;
157 feature->n_properties = c * 2;
158 feature->properties = properties;
static TupleDesc get_tuple_desc(struct geobuf_agg_context *ctx)
static void set_int_value(Data__Value *value, int64 intval)