172 for (i = 0; i < (uint32_t) ctx->
tupdesc->natts; i++) {
175 datum = GetAttributeByNum(ctx->
row, i + 1, &isnull);
179 memcpy(ctx->
ctx->properties + offset, &ci,
sizeof(ci));
180 offset +=
sizeof(ci);
181 typoid = getBaseType(TupleDescAttr(ctx->
tupdesc, i)->atttypid);
184 byte_value = DatumGetBool(datum) ? 1 : 0;
186 memcpy(ctx->
ctx->properties + offset, &byte_value,
sizeof(byte_value));
187 offset +=
sizeof(byte_value);
190 short_value = DatumGetInt16(datum);
192 memcpy(ctx->
ctx->properties + offset, &short_value,
sizeof(short_value));
193 offset +=
sizeof(short_value);
196 int_value = DatumGetInt32(datum);
198 memcpy(ctx->
ctx->properties + offset, &int_value,
sizeof(int_value));
199 offset +=
sizeof(int_value);
202 long_value = DatumGetInt64(datum);
204 memcpy(ctx->
ctx->properties + offset, &long_value,
sizeof(long_value));
205 offset +=
sizeof(long_value);
208 float_value = DatumGetFloat4(datum);
210 memcpy(ctx->
ctx->properties + offset, &float_value,
sizeof(float_value));
211 offset +=
sizeof(float_value);
214 double_value = DatumGetFloat8(datum);
216 memcpy(ctx->
ctx->properties + offset, &double_value,
sizeof(double_value));
217 offset +=
sizeof(double_value);
220 string_value = text_to_cstring(DatumGetTextP(datum));
221 len = strlen(string_value);
223 memcpy(ctx->
ctx->properties + offset, &len,
sizeof(len));
224 offset +=
sizeof(len);
226 memcpy(ctx->
ctx->properties + offset, string_value, len);
229 case TIMESTAMPTZOID: {
233 const char *tzn = NULL;
234 TimestampTz timestamp;
235 timestamp = DatumGetTimestampTz(datum);
236 timestamp2tm(timestamp, &tz, &tm, &fsec, &tzn, NULL);
237 string_value = palloc(MAXDATELEN + 1);
238 EncodeDateTime(&tm, fsec,
true, tz, tzn, USE_ISO_DATES, string_value);
239 len = strlen(string_value);
241 memcpy(ctx->
ctx->properties + offset, &len,
sizeof(len));
242 offset +=
sizeof(len);
244 memcpy(ctx->
ctx->properties + offset, string_value, len);
263 POSTGIS_DEBUGF(3,
"offset %ld", offset);
264 ctx->
ctx->properties_len = offset;
static void ensure_properties_size(struct flatgeobuf_agg_ctx *ctx, size_t size)