PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ DBFGetFieldInfo()

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

Definition at line 1217 of file dbfopen.c.

Referenced by DBFGetFieldIndex(), and ShpLoaderOpenShape().

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