MCPcopy Index your code
hub / github.com/MapServer/MapServer / msDBFGetItemIndex

Function msDBFGetItemIndex

mapxbase.c:815–836  ·  view source on GitHub ↗

** Which column number in the .DBF file does the item correspond to */

Source from the content-addressed store, hash-verified

813** Which column number in the .DBF file does the item correspond to
814*/
815int msDBFGetItemIndex(DBFHandle dbffile, char *name)
816{
817 int i;
818 DBFFieldType dbfField;
819 int fWidth,fnDecimals; /* field width and number of decimals */
820 char fName[32]; /* field name */
821
822 if(!name) {
823 msSetError(MS_MISCERR, "NULL item name passed.", "msGetItemIndex()");
824 return(-1);
825 }
826
827 /* does name exist as a field? */
828 for(i=0;i<msDBFGetFieldCount(dbffile);i++) {
829 dbfField = msDBFGetFieldInfo(dbffile,i,fName,&fWidth,&fnDecimals);
830 if(strcasecmp(name,fName) == 0) /* found it */
831 return(i);
832 }
833
834 msSetError(MS_DBFERR, "Item '%s' not found.", "msDBFGetItemIndex()",name);
835 return(-1); /* item not found */
836}
837
838/*
839** Load item names into a character array

Callers 3

msTiledSHPOpenFileFunction · 0.85
msDBFGetItemIndexesFunction · 0.85
msDBFJoinConnectFunction · 0.85

Calls 4

msSetErrorFunction · 0.85
msDBFGetFieldCountFunction · 0.85
msDBFGetFieldInfoFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected