PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ array_to_json_internal()

static void array_to_json_internal ( Datum  array,
StringInfo  result,
bool  use_line_feeds 
)
static

Definition at line 490 of file lwgeom_out_geojson.c.

491 {
492  ArrayType *v = DatumGetArrayTypeP(array);
493  Oid element_type = ARR_ELEMTYPE(v);
494  int *dim;
495  int ndim;
496  int nitems;
497  int count = 0;
498  Datum *elements;
499  bool *nulls;
500  int16 typlen;
501  bool typbyval;
502  char typalign;
503  JsonTypeCategory tcategory;
504  Oid outfuncoid;
505 
506  ndim = ARR_NDIM(v);
507  dim = ARR_DIMS(v);
508  nitems = ArrayGetNItems(ndim, dim);
509 
510  if (nitems <= 0)
511  {
512  appendStringInfoString(result, "[]");
513  return;
514  }
515 
516  get_typlenbyvalalign(element_type,
517  &typlen, &typbyval, &typalign);
518 
519  json_categorize_type(element_type,
520  &tcategory, &outfuncoid);
521 
522  deconstruct_array(v, element_type, typlen, typbyval,
523  typalign, &elements, &nulls,
524  &nitems);
525 
526  array_dim_to_json(result, 0, ndim, dim, elements, nulls, &count, tcategory,
527  outfuncoid, use_line_feeds);
528 
529  pfree(elements);
530  pfree(nulls);
531 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
static void json_categorize_type(Oid typoid, JsonTypeCategory *tcategory, Oid *outfuncoid)
JsonTypeCategory
static void array_dim_to_json(StringInfo result, int dim, int ndims, int *dims, Datum *vals, bool *nulls, int *valcount, JsonTypeCategory tcategory, Oid outfuncoid, bool use_line_feeds)
int count
Definition: genraster.py:57

References array_dim_to_json(), genraster::count, json_categorize_type(), and result.

Referenced by datum_to_json().

Here is the call graph for this function:
Here is the caller graph for this function: