-------------------------------------------------------------------- */ msSDELayerInitItemInfo */ -------------------------------------------------------------------- */ Connects to SDE and returns the column names and SDE's column */ descriptions. It stores them on layer->items and layer->iteminfo */ If a join table has been specified throu
| 1861 | /* it's column definitions are appended to both lists. */ |
| 1862 | /* -------------------------------------------------------------------- */ |
| 1863 | int |
| 1864 | msSDELayerInitItemInfo(layerObj *layer) |
| 1865 | { |
| 1866 | #ifdef USE_SDE |
| 1867 | |
| 1868 | int i,j; |
| 1869 | /* short nBaseColumns, nJoinColumns; */ |
| 1870 | long status; |
| 1871 | short nbasecol, njoincol; |
| 1872 | SE_COLUMN_DEF *all_itemdefs = NULL; |
| 1873 | |
| 1874 | msSDELayerInfo *sde = NULL; |
| 1875 | /* nBaseColumns = 0; */ |
| 1876 | /* nJoinColumns = 0; */ |
| 1877 | |
| 1878 | char *proc_key = NULL; |
| 1879 | |
| 1880 | if (!msSDELayerIsOpen(layer)) { |
| 1881 | msSetError( MS_SDEERR, |
| 1882 | "SDE layer has not been opened.", |
| 1883 | "msSDELayerInitItemInfo()"); |
| 1884 | return(MS_FAILURE); |
| 1885 | } |
| 1886 | |
| 1887 | sde = layer->layerinfo; |
| 1888 | |
| 1889 | /* |
| 1890 | ** This insanity is because we keep around the number of |
| 1891 | ** columns we have along with the layer info. If the total |
| 1892 | ** number of columns that we have doesn't match when we're |
| 1893 | ** called the second time around, we have to throw an error or |
| 1894 | ** msWhichShape will add an item onto our layer->items list, which |
| 1895 | ** in turn doesn't match the layer->iteminfo list of SDE column definitions. |
| 1896 | */ |
| 1897 | |
| 1898 | nbasecol =*(sde->nBaseColumns); |
| 1899 | njoincol =*(sde->nJoinColumns); |
| 1900 | |
| 1901 | /* Hop right out again if we've already gotten the layer->iteminfo */ |
| 1902 | if (layer->iteminfo && layer->items) { |
| 1903 | if (layer->debug) |
| 1904 | msDebug("Column information has already been gotten..." |
| 1905 | " returning from msSDELayerInitItemInfo\n"); |
| 1906 | if (layer->numitems != ( nbasecol+ njoincol)) { |
| 1907 | /* if someone has modified the size of the items list, |
| 1908 | ** it is because it didn't find a column name (and we have |
| 1909 | ** already given them all because we have iteminfo and items |
| 1910 | ** If this is the case, we can't continue. */ |
| 1911 | |
| 1912 | msSetError( MS_SDEERR, |
| 1913 | "A specified CLASSITEM, FILTERITEM, or expression key cannot be found", |
| 1914 | "msSDELayerInitItemInfo()"); |
| 1915 | return(MS_FAILURE); |
| 1916 | } |
| 1917 | return (MS_SUCCESS); |
| 1918 | } |
| 1919 | if (layer->debug) |
| 1920 | msDebug("Getting all column information in msSDELayerInitItemInfo\n"); |
no test coverage detected