fetch next shape from previous SELECT stmt (see *WhichShape()) */
| 2252 | |
| 2253 | /* fetch next shape from previous SELECT stmt (see *WhichShape()) */ |
| 2254 | int msOracleSpatialLayerNextShape( layerObj *layer, shapeObj *shape ) |
| 2255 | { |
| 2256 | SDOGeometryObj *obj; |
| 2257 | SDOGeometryInd *ind; |
| 2258 | int success, /*lIntSuccessFree,*/ i; |
| 2259 | |
| 2260 | /* get layerinfo */ |
| 2261 | msOracleSpatialLayerInfo *layerinfo = (msOracleSpatialLayerInfo *)layer->layerinfo; |
| 2262 | msOracleSpatialDataHandler *dthand = NULL; |
| 2263 | msOracleSpatialHandler *hand = NULL; |
| 2264 | msOracleSpatialStatement *sthand = NULL; |
| 2265 | |
| 2266 | |
| 2267 | if (layerinfo == NULL) |
| 2268 | { |
| 2269 | msSetError( MS_ORACLESPATIALERR, "msOracleSpatialLayerWhichShapes called on unopened layer", "msOracleSpatialLayerNextShape()" ); |
| 2270 | return MS_FAILURE; |
| 2271 | } |
| 2272 | else |
| 2273 | { |
| 2274 | dthand = (msOracleSpatialDataHandler *)layerinfo->oradatahandlers; |
| 2275 | hand = (msOracleSpatialHandler *)layerinfo->orahandlers; |
| 2276 | sthand = (msOracleSpatialStatement *)layerinfo->orastmt2; |
| 2277 | } |
| 2278 | |
| 2279 | /* no rows fetched */ |
| 2280 | if (sthand->rows_fetched == 0) |
| 2281 | return MS_DONE; |
| 2282 | |
| 2283 | if(layer->debug >=5 ) |
| 2284 | msDebug("msOracleSpatialLayerNextShape on layer %p, row_num: %d\n", layer, sthand->row_num); |
| 2285 | |
| 2286 | do{ |
| 2287 | /* is buffer empty? */ |
| 2288 | if (sthand->row >= sthand->rows_fetched) |
| 2289 | { |
| 2290 | /* fetch more */ |
| 2291 | success = TRY( hand, OCIStmtFetch2( sthand->stmthp, hand->errhp, (ub4)ARRAY_SIZE, (ub2)OCI_FETCH_NEXT, (sb4)0, (ub4)OCI_DEFAULT ) ) |
| 2292 | && TRY( hand, OCIAttrGet( (dvoid *)sthand->stmthp, (ub4)OCI_HTYPE_STMT, (dvoid *)&sthand->rows_fetched, (ub4 *)0, (ub4)OCI_ATTR_ROWS_FETCHED, hand->errhp ) ) |
| 2293 | && TRY( hand, OCIAttrGet( (dvoid *)sthand->stmthp, (ub4)OCI_HTYPE_STMT, (dvoid *)&sthand->rows_count, (ub4 *)0, (ub4)OCI_ATTR_ROW_COUNT, hand->errhp ) ); |
| 2294 | |
| 2295 | if(layer->debug >= 4 ) |
| 2296 | msDebug("msOracleSpatialLayerNextShape on layer %p, Fetched %d more rows (%d total)\n", layer, sthand->rows_fetched, sthand->rows_count); |
| 2297 | |
| 2298 | |
| 2299 | if (!success || sthand->rows_fetched == 0) |
| 2300 | return MS_DONE; |
| 2301 | |
| 2302 | if (sthand->row_num >= sthand->rows_count) |
| 2303 | return MS_DONE; |
| 2304 | |
| 2305 | sthand->row = 0; /* reset buffer row index */ |
| 2306 | } |
| 2307 | |
| 2308 | /* set obj & ind for current row */ |
| 2309 | obj = sthand->obj[ sthand->row ]; |
| 2310 | ind = sthand->ind[ sthand->row ]; |
| 2311 |
nothing calls this directly
no test coverage detected