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

Definition at line 351 of file gserialized_typmod.c.

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

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

Here is the call graph for this function: