105 Data__Value **values;
109 properties = palloc(
sizeof (*properties) * (natts - 1) * 2);
110 values = palloc (
sizeof (*values) * (natts - 1));
112 for (i = 0; i < natts; i++) {
114 char *
type, *string_value;
124 data__value__init(
value);
126 type = SPI_gettype(tupdesc, i + 1);
127 datum = GetAttributeByNum(ctx->
row, i + 1, &isnull);
130 #if POSTGIS_PGSQL_VERSION < 110
131 typoid = getBaseType(tupdesc->attrs[i]->atttypid);
133 typoid = getBaseType(tupdesc->attrs[i].atttypid);
135 if (strcmp(
type,
"int2") == 0) {
137 }
else if (strcmp(
type,
"int4") == 0) {
139 }
else if (strcmp(
type,
"int8") == 0) {
141 }
else if (strcmp(
type,
"float4") == 0) {
142 value->value_type_case = DATA__VALUE__VALUE_TYPE_DOUBLE_VALUE;
143 value->double_value = DatumGetFloat4(datum);
144 }
else if (strcmp(
type,
"float8") == 0) {
145 value->value_type_case = DATA__VALUE__VALUE_TYPE_DOUBLE_VALUE;
146 value->double_value = DatumGetFloat8(datum);
150 getTypeOutputInfo(typoid, &foutoid, &typisvarlena);
151 string_value = OidOutputFunctionCall(foutoid, datum);
152 value->value_type_case = DATA__VALUE__VALUE_TYPE_STRING_VALUE;
153 value->string_value = string_value;
155 properties[c * 2] = k - 1;
156 properties[c * 2 + 1] = c;
160 ReleaseTupleDesc(tupdesc);
162 feature->n_values = c;
163 feature->values = values;
164 feature->n_properties = c * 2;
165 feature->properties = properties;
static TupleDesc get_tuple_desc(struct geobuf_agg_context *ctx)
static void set_int_value(Data__Value *value, int64 intval)