PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ DBFIsValueNULL()

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

Definition at line 1111 of file dbfopen.c.

References FALSE, SHPAPI_CALL, and TRUE.

Referenced by DBFAlterFieldDefn(), and DBFIsAttributeNULL().

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