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

Function msOracleSpatialLayerOpen

maporaclespatial.c:1750–1853  ·  view source on GitHub ↗

opens a layer by connecting to db with username/password@database stored in layer->connection */

Source from the content-addressed store, hash-verified

1748
1749/* opens a layer by connecting to db with username/password@database stored in layer->connection */
1750int msOracleSpatialLayerOpen( layerObj *layer )
1751{
1752 char *username = NULL, *password = NULL, *dblink = NULL;
1753
1754 msOracleSpatialLayerInfo *layerinfo = NULL;
1755 msOracleSpatialDataHandler *dthand = NULL;
1756 msOracleSpatialStatement *sthand = NULL, *sthand2 = NULL;
1757 msOracleSpatialHandler *hand = NULL;
1758
1759 if (layer->debug)
1760 msDebug("msOracleSpatialLayerOpen called with: %s (Layer pointer %p)\n",layer->data, layer);
1761
1762 if (layer->layerinfo != NULL) /* Skip if layer is already open */
1763 return MS_SUCCESS;
1764
1765 if (layer->data == NULL)
1766 {
1767 msSetError( MS_ORACLESPATIALERR,
1768 "Error parsing OracleSpatial DATA variable. Must be:"
1769 "'geometry_column FROM table_name [USING UNIQUE <column> SRID srid# FUNCTION]' or "
1770 "'geometry_column FROM (SELECT stmt) [USING UNIQUE <column> SRID srid# FUNCTION]'."
1771 "If want to set the FUNCTION statement you can use: FILTER, RELATE, GEOMRELATE or NONE.",
1772 "msOracleSpatialLayerOpen()");
1773
1774 return MS_FAILURE;
1775 }
1776
1777 layerinfo = (msOracleSpatialLayerInfo *)malloc(sizeof(msOracleSpatialLayerInfo));
1778 dthand = (msOracleSpatialDataHandler *)malloc(sizeof(msOracleSpatialDataHandler));
1779 sthand = (msOracleSpatialStatement *)malloc(sizeof(msOracleSpatialStatement));
1780 sthand2 = (msOracleSpatialStatement *)malloc(sizeof(msOracleSpatialStatement));
1781
1782 if ((dthand == NULL) || (layerinfo == NULL))
1783 {
1784 msSetError(MS_MEMERR, NULL, "msOracleSpatialLayerOpen()");
1785 return MS_FAILURE;
1786 }
1787
1788 memset( dthand, 0, sizeof(msOracleSpatialDataHandler) );
1789 memset( sthand, 0, sizeof(msOracleSpatialStatement) );
1790 memset( sthand2, 0, sizeof(msOracleSpatialStatement) );
1791 memset( layerinfo, 0, sizeof(msOracleSpatialLayerInfo) );
1792
1793 msSplitLogin( layer->connection, layer->map, &username, &password, &dblink );
1794
1795 hand = (msOracleSpatialHandler *) msConnPoolRequest( layer );
1796
1797 if( hand == NULL )
1798 {
1799
1800 hand = msOCISetHandlers( username, password, dblink );
1801
1802 if (hand == NULL)
1803 {
1804 msOCICloseDataHandlers( dthand );
1805 msOCIFinishStatement( sthand );
1806 msOCIFinishStatement( sthand2 );
1807 msOCIClearLayerInfo( layerinfo );

Callers

nothing calls this directly

Calls 12

msDebugFunction · 0.85
msSetErrorFunction · 0.85
msSplitLoginFunction · 0.85
msConnPoolRequestFunction · 0.85
msOCISetHandlersFunction · 0.85
msOCICloseDataHandlersFunction · 0.85
msOCIFinishStatementFunction · 0.85
msOCIClearLayerInfoFunction · 0.85
msConnPoolRegisterFunction · 0.85
msOCISetDataHandlersFunction · 0.85
msOCIOpenStatementFunction · 0.85
msOCICloseHandlersFunction · 0.85

Tested by

no test coverage detected