PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ DBFIsValueNULL()

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

Definition at line 1115 of file dbfopen.c.

References FALSE, SHPAPI_CALL, and TRUE.

Referenced by DBFAlterFieldDefn(), and DBFIsAttributeNULL().

1116 {
1117  int i;
1118 
1119  if( pszValue == NULL )
1120  return TRUE;
1121 
1122  switch(chType)
1123  {
1124  case 'N':
1125  case 'F':
1126  /*
1127  ** We accept all asterisks or all blanks as NULL
1128  ** though according to the spec I think it should be all
1129  ** asterisks.
1130  */
1131  if( pszValue[0] == '*' )
1132  return TRUE;
1133 
1134  for( i = 0; pszValue[i] != '\0'; i++ )
1135  {
1136  if( pszValue[i] != ' ' )
1137  return FALSE;
1138  }
1139  return TRUE;
1140 
1141  case 'D':
1142  /* NULL date fields have value "00000000" or blank or empty */
1143  if (pszValue[0] == '\0' || /* emtpy string */
1144  strncmp(pszValue,"00000000",8) == 0 ||
1145  strncmp(pszValue," ",8) == 0) {
1146  return 1;
1147  } else {
1148  return 0;
1149  }
1150  /* return strncmp(pszValue,"00000000",8) == 0; */
1151 
1152  case 'L':
1153  /* NULL boolean fields have value "?" or empty */
1154  if (pszValue[0] == '\0' || pszValue[0] == '?') {
1155  return 1;
1156  } else {
1157  return 0;
1158  }
1159 
1160  default:
1161  /* empty string fields are considered NULL */
1162  return strlen(pszValue) == 0;
1163  }
1164 }
#define FALSE
Definition: dbfopen.c:168
#define TRUE
Definition: dbfopen.c:169
Here is the caller graph for this function: