PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ goodDBFValue()

static char * goodDBFValue ( char *  in,
char  fieldType 
)
static

Make appropriate formatting of a DBF value based on type.

Might return untouched input or pointer to static private buffer: use return value right away.

Definition at line 650 of file pgsql2shp-core.c.

651 {
652  /*
653  * We only work on FTLogical and FTDate.
654  * FTLogical is 1 byte, FTDate is 8 byte (YYYYMMDD)
655  * We allocate space for 9 bytes to take
656  * terminating null into account
657  */
658  static char buf[9];
659 
660  switch (fieldType)
661  {
662  case FTLogical:
663  buf[0] = toupper(in[0]);
664  buf[1]='\0';
665  return buf;
666  case FTDate:
667  buf[0]=in[0]; /* Y */
668  buf[1]=in[1]; /* Y */
669  buf[2]=in[2]; /* Y */
670  buf[3]=in[3]; /* Y */
671  buf[4]=in[5]; /* M */
672  buf[5]=in[6]; /* M */
673  buf[6]=in[8]; /* D */
674  buf[7]=in[9]; /* D */
675  buf[8]='\0';
676  return buf;
677  default:
678  return in;
679  }
680 }
@ FTLogical
Definition: shapefil.h:642
@ FTDate
Definition: shapefil.h:643

References FTDate, and FTLogical.

Referenced by ShpLoaderGenerateShapeRow().

Here is the caller graph for this function: