** Which column number in the .DBF file does the item correspond to */
| 813 | ** Which column number in the .DBF file does the item correspond to |
| 814 | */ |
| 815 | int 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 |
no test coverage detected