PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ DBFGetFieldInfo()

DBFFieldType SHPAPI_CALL DBFGetFieldInfo ( DBFHandle  psDBF,
int  iField,
char *  pszFieldName,
int *  pnWidth,
int *  pnDecimals 
)

Definition at line 1188 of file dbfopen.c.

1189 {
1190  if (iField < 0 || iField >= psDBF->nFields)
1191  return (FTInvalid);
1192 
1193  if (pnWidth != NULL)
1194  *pnWidth = psDBF->panFieldSize[iField];
1195 
1196  if (pnDecimals != NULL)
1197  *pnDecimals = psDBF->panFieldDecimals[iField];
1198 
1199  if (pszFieldName != NULL)
1200  {
1201  int i;
1202 
1203  strncpy(pszFieldName, (char *)psDBF->pszHeader + iField * 32, 11);
1204  pszFieldName[11] = '\0';
1205  for (i = 10; i > 0 && pszFieldName[i] == ' '; i--)
1206  pszFieldName[i] = '\0';
1207  }
1208 
1209  if (psDBF->pachFieldType[iField] == 'L')
1210  return (FTLogical);
1211 
1212  else if (psDBF->pachFieldType[iField] == 'D')
1213  return (FTDate);
1214 
1215  else if (psDBF->pachFieldType[iField] == 'N' || psDBF->pachFieldType[iField] == 'F')
1216  {
1217  if (psDBF->panFieldDecimals[iField] > 0 || psDBF->panFieldSize[iField] > 10)
1218  return (FTDouble);
1219  else
1220  return (FTInteger);
1221  }
1222  else
1223  {
1224  return (FTString);
1225  }
1226 }

Referenced by DBFGetFieldIndex(), and ShpLoaderOpenShape().

Here is the caller graph for this function: