173 for (i = 0; i < (uint32_t) ctx->
tupdesc->natts; i++) {
176 datum = GetAttributeByNum(ctx->
row, i + 1, &isnull);
180 memcpy(ctx->
ctx->properties + offset, &ci,
sizeof(ci));
181 offset +=
sizeof(ci);
182 typoid = getBaseType(TupleDescAttr(ctx->
tupdesc, i)->atttypid);
185 byte_value = DatumGetBool(datum) ? 1 : 0;
187 memcpy(ctx->
ctx->properties + offset, &byte_value,
sizeof(byte_value));
188 offset +=
sizeof(byte_value);
191 short_value = DatumGetInt16(datum);
193 memcpy(ctx->
ctx->properties + offset, &short_value,
sizeof(short_value));
194 offset +=
sizeof(short_value);
197 int_value = DatumGetInt32(datum);
199 memcpy(ctx->
ctx->properties + offset, &int_value,
sizeof(int_value));
200 offset +=
sizeof(int_value);
203 long_value = DatumGetInt64(datum);
205 memcpy(ctx->
ctx->properties + offset, &long_value,
sizeof(long_value));
206 offset +=
sizeof(long_value);
209 float_value = DatumGetFloat4(datum);
211 memcpy(ctx->
ctx->properties + offset, &float_value,
sizeof(float_value));
212 offset +=
sizeof(float_value);
215 double_value = DatumGetFloat8(datum);
217 memcpy(ctx->
ctx->properties + offset, &double_value,
sizeof(double_value));
218 offset +=
sizeof(double_value);
221 string_value = text_to_cstring(DatumGetTextP(datum));
222 len = strlen(string_value);
224 memcpy(ctx->
ctx->properties + offset, &len,
sizeof(len));
225 offset +=
sizeof(len);
227 memcpy(ctx->
ctx->properties + offset, string_value, len);
230 case TIMESTAMPTZOID: {
234 const char *tzn = NULL;
235 TimestampTz timestamp;
236 timestamp = DatumGetTimestampTz(datum);
237 timestamp2tm(timestamp, &tz, &tm, &fsec, &tzn, NULL);
238 string_value = palloc(MAXDATELEN + 1);
239 EncodeDateTime(&tm, fsec,
true, tz, tzn, USE_ISO_DATES, string_value);
240 len = strlen(string_value);
242 memcpy(ctx->
ctx->properties + offset, &len,
sizeof(len));
243 offset +=
sizeof(len);
245 memcpy(ctx->
ctx->properties + offset, string_value, len);
264 POSTGIS_DEBUGF(3,
"offset %ld", offset);
265 ctx->
ctx->properties_len = offset;
static void ensure_properties_size(struct flatgeobuf_agg_ctx *ctx, size_t size)