MCPcopy Create free account
hub / github.com/MapServer/MapServer / msSDELayerGetShape

Function msSDELayerGetShape

mapsde.c:1732–1822  ·  view source on GitHub ↗

-------------------------------------------------------------------- */ msSDELayerGetShape */ -------------------------------------------------------------------- */ Queries SDE for a shape (and its attributes, if requested) */ given the ID (which is the MS_SDE_ROW_ID_COLUMN column */ ------------------------------------------------

Source from the content-addressed store, hash-verified

1730/* given the ID (which is the MS_SDE_ROW_ID_COLUMN column */
1731/* -------------------------------------------------------------------- */
1732int msSDELayerGetShape(layerObj *layer, shapeObj *shape, resultObj *record) {
1733#ifdef USE_SDE
1734 long status;
1735
1736 SE_SQL_CONSTRUCT* sql;
1737
1738 msSDELayerInfo *sde=NULL;
1739
1740 long shapeindex = record->shapeindex;
1741
1742 if(!msSDELayerIsOpen(layer)) {
1743 msSetError( MS_SDEERR,
1744 "SDE layer has not been opened.",
1745 "msSDELayerGetShape()");
1746 return(MS_FAILURE);
1747 }
1748
1749 sde = layer->layerinfo;
1750
1751 /* must be at least one thing to retrieve (i.e. spatial column) */
1752 if(layer->numitems < 1) {
1753 msSetError( MS_MISCERR,
1754 "No items requested, SDE requires at least one item.",
1755 "msSDELayerGetShape()");
1756 return(MS_FAILURE);
1757 }
1758
1759 /* reset the stream */
1760 status = SE_stream_close(sde->connPoolInfo->stream, 1);
1761 if(status != SE_SUCCESS) {
1762 sde_error( status,
1763 "msSDELayerGetShape()",
1764 "SE_stream_close()");
1765 return(MS_FAILURE);
1766 }
1767
1768 if (!sde->join_table) {
1769
1770 status = SE_stream_fetch_row( sde->connPoolInfo->stream,
1771 sde->table,
1772 shapeindex,
1773 (short)(layer->numitems),
1774 (const char **)layer->items);
1775
1776 if(status != SE_SUCCESS) {
1777 sde_error( status,
1778 "msSDELayerGetShape()",
1779 "SE_stream_fetch_row()");
1780 return(MS_FAILURE);
1781 }
1782 } else {
1783 sql = getSDESQLConstructInfo(layer, &shapeindex);
1784
1785 status = SE_stream_query(sde->connPoolInfo->stream, layer->numitems, (const CHAR**) layer->items, sql);
1786;
1787 if(status != SE_SUCCESS) {
1788 sde_error(status,
1789 "msSDELayerWhichShapes()",

Callers

nothing calls this directly

Calls 5

msSDELayerIsOpenFunction · 0.85
msSetErrorFunction · 0.85
sde_errorFunction · 0.85
getSDESQLConstructInfoFunction · 0.85
sdeGetRecordFunction · 0.85

Tested by

no test coverage detected