PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum postgis_typmod_type ( PG_FUNCTION_ARGS  )

Definition at line 352 of file gserialized_typmod.c.

References lwtype_name(), s, TYPMOD_GET_M, TYPMOD_GET_TYPE, and TYPMOD_GET_Z.

353 {
354  int32 typmod = PG_GETARG_INT32(0);
355  int32 type = TYPMOD_GET_TYPE(typmod);
356  char *s = (char*)palloc(64);
357  char *ptr = s;
358  text *stext;
359 
360  /* Has type? */
361  if ( typmod < 0 || type == 0 )
362  ptr += sprintf(ptr, "Geometry");
363  else
364  ptr += sprintf(ptr, "%s", lwtype_name(type));
365 
366  /* Has Z? */
367  if ( typmod >= 0 && TYPMOD_GET_Z(typmod) )
368  ptr += sprintf(ptr, "%s", "Z");
369 
370  /* Has M? */
371  if ( typmod >= 0 && TYPMOD_GET_M(typmod) )
372  ptr += sprintf(ptr, "%s", "M");
373 
374  stext = cstring2text(s);
375  pfree(s);
376  PG_RETURN_TEXT_P(stext);
377 }
#define TYPMOD_GET_TYPE(typmod)
Definition: liblwgeom.h:151
unsigned int int32
Definition: shpopen.c:273
#define TYPMOD_GET_M(typmod)
Definition: liblwgeom.h:155
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
char * s
Definition: cu_in_wkt.c:23
#define TYPMOD_GET_Z(typmod)
Definition: liblwgeom.h:153

Here is the call graph for this function: