PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int DBFIsValueNULL ( char  chType,
const char *  pszValue 
)
static

Definition at line 1112 of file dbfopen.c.

References FALSE, and TRUE.

Referenced by DBFAlterFieldDefn(), and DBFIsAttributeNULL().

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

Here is the caller graph for this function: