PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ DBFGetFieldInfo()

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

Definition at line 1221 of file dbfopen.c.

Referenced by DBFGetFieldIndex(), and ShpLoaderOpenShape().

1224 {
1225  if( iField < 0 || iField >= psDBF->nFields )
1226  return( FTInvalid );
1227 
1228  if( pnWidth != NULL )
1229  *pnWidth = psDBF->panFieldSize[iField];
1230 
1231  if( pnDecimals != NULL )
1232  *pnDecimals = psDBF->panFieldDecimals[iField];
1233 
1234  if( pszFieldName != NULL )
1235  {
1236  int i;
1237 
1238  strncpy( pszFieldName, (char *) psDBF->pszHeader+iField*32, 11 );
1239  pszFieldName[11] = '\0';
1240  for( i = 10; i > 0 && pszFieldName[i] == ' '; i-- )
1241  pszFieldName[i] = '\0';
1242  }
1243 
1244  if ( psDBF->pachFieldType[iField] == 'L' )
1245  return( FTLogical);
1246 
1247  else if ( psDBF->pachFieldType[iField] == 'D' )
1248  return ( FTDate );
1249 
1250  else if( psDBF->pachFieldType[iField] == 'N'
1251  || psDBF->pachFieldType[iField] == 'F' )
1252  {
1253  if( psDBF->panFieldDecimals[iField] > 0
1254  || psDBF->panFieldSize[iField] > 10 )
1255  return( FTDouble );
1256  else
1257  return( FTInteger );
1258  }
1259  else
1260  {
1261  return( FTString );
1262  }
1263 }
Here is the caller graph for this function: