| 2355 | } |
| 2356 | |
| 2357 | int msOracleSpatialLayerGetShape( layerObj *layer, shapeObj *shape, resultObj *record) |
| 2358 | { |
| 2359 | int success, i; |
| 2360 | SDOGeometryObj *obj; |
| 2361 | SDOGeometryInd *ind; |
| 2362 | msOracleSpatialDataHandler *dthand = NULL; |
| 2363 | msOracleSpatialHandler *hand = NULL; |
| 2364 | msOracleSpatialLayerInfo *layerinfo; |
| 2365 | msOracleSpatialStatement *sthand = NULL; |
| 2366 | |
| 2367 | long shapeindex = record->shapeindex; |
| 2368 | int resultindex = record->resultindex; |
| 2369 | |
| 2370 | if(layer == NULL) { |
| 2371 | msSetError( MS_ORACLESPATIALERR, "msOracleSpatialLayerGetShape called on unopened layer","msOracleSpatialLayerGetShape()" ); |
| 2372 | return MS_FAILURE; |
| 2373 | } |
| 2374 | |
| 2375 | layerinfo = (msOracleSpatialLayerInfo *)layer->layerinfo; |
| 2376 | |
| 2377 | if (layerinfo == NULL) |
| 2378 | { |
| 2379 | msSetError( MS_ORACLESPATIALERR, "msOracleSpatialLayerGetShape called on unopened layer (layerinfo)","msOracleSpatialLayerGetShape()" ); |
| 2380 | return MS_FAILURE; |
| 2381 | } |
| 2382 | |
| 2383 | /* If resultindex is set, fetch the shape from the resultcache, otherwise fetch it from the DB */ |
| 2384 | if (resultindex >= 0) |
| 2385 | { |
| 2386 | long buffer_first_row_num, buffer_last_row_num; |
| 2387 | |
| 2388 | /* get layerinfo */ |
| 2389 | dthand = (msOracleSpatialDataHandler *)layerinfo->oradatahandlers; |
| 2390 | hand = (msOracleSpatialHandler *)layerinfo->orahandlers; |
| 2391 | sthand = (msOracleSpatialStatement *)layerinfo->orastmt2; |
| 2392 | |
| 2393 | if (layer->resultcache == NULL) |
| 2394 | { |
| 2395 | msSetError( MS_ORACLESPATIALERR, "msOracleSpatialLayerGetShape called before msOracleSpatialLayerWhichShapes()","msOracleSpatialLayerGetShape()" ); |
| 2396 | return MS_FAILURE; |
| 2397 | } |
| 2398 | |
| 2399 | if (resultindex >= sthand->rows_count) |
| 2400 | { |
| 2401 | if (layer->debug >= 5) |
| 2402 | msDebug("msOracleSpatialLayerGetShape problem with cursor. Trying to fetch record = %ld of %ld, falling back to GetShape\n", resultindex, sthand->rows_count); |
| 2403 | |
| 2404 | msSetError( MS_ORACLESPATIALERR, "msOracleSpatialLayerGetShape record out of range","msOracleSpatialLayerGetShape()" ); |
| 2405 | return MS_FAILURE; |
| 2406 | } |
| 2407 | |
| 2408 | if (layer->debug >= 5) |
| 2409 | msDebug("msOracleSpatialLayerGetShape was called. Using the record = %ld of %ld. (shape: %ld should equal pkey: %ld)\n", |
| 2410 | resultindex, layer->resultcache->numresults, layer->resultcache->results[resultindex].shapeindex, shapeindex); |
| 2411 | |
| 2412 | /* NOTE: with the way the resultcache works, we should see items in increasing order, but some may have been filtered out. */ |
| 2413 | /* Best case: item in buffer */ |
| 2414 | /* Next best case: item is in next fetch block */ |
nothing calls this directly
no test coverage detected