PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ DBFIsValueNULL()

static int DBFIsValueNULL ( char  chType,
const char *  pszValue 
)
static

Definition at line 1080 of file dbfopen.c.

1081 {
1082  int i;
1083 
1084  if (pszValue == NULL)
1085  return TRUE;
1086 
1087  switch (chType)
1088  {
1089  case 'N':
1090  case 'F':
1091  /*
1092  ** We accept all asterisks or all blanks as NULL
1093  ** though according to the spec I think it should be all
1094  ** asterisks.
1095  */
1096  if (pszValue[0] == '*')
1097  return TRUE;
1098 
1099  for (i = 0; pszValue[i] != '\0'; i++)
1100  {
1101  if (pszValue[i] != ' ')
1102  return FALSE;
1103  }
1104  return TRUE;
1105 
1106  case 'D':
1107  /* NULL date fields have value "00000000" or blank or empty */
1108  if (pszValue[0] == '\0' || /* emtpy string */
1109  strncmp(pszValue, "00000000", 8) == 0 || strncmp(pszValue, " ", 8) == 0)
1110  {
1111  return 1;
1112  }
1113  else
1114  {
1115  return 0;
1116  }
1117  /* return strncmp(pszValue,"00000000",8) == 0; */
1118 
1119  case 'L':
1120  /* NULL boolean fields have value "?" or empty */
1121  if (pszValue[0] == '\0' || pszValue[0] == '?')
1122  {
1123  return 1;
1124  }
1125  else
1126  {
1127  return 0;
1128  }
1129 
1130  default:
1131  /* empty string fields are considered NULL */
1132  return strlen(pszValue) == 0;
1133  }
1134 }
#define TRUE
Definition: dbfopen.c:169
#define FALSE
Definition: dbfopen.c:168

References FALSE, and TRUE.

Referenced by DBFAlterFieldDefn(), and DBFIsAttributeNULL().

Here is the caller graph for this function: