| 3222 | } |
| 3223 | |
| 3224 | int msOracleSpatialLayerGetExtent(layerObj *layer, rectObj *extent) |
| 3225 | { |
| 3226 | char *table_name; |
| 3227 | char query_str[6000], *geom_column_name = NULL, *unique = NULL, *srid = NULL; |
| 3228 | int success, i; |
| 3229 | int function = 0; |
| 3230 | int version = 0; |
| 3231 | SDOGeometryObj *obj = NULL; |
| 3232 | SDOGeometryInd *ind = NULL; |
| 3233 | shapeObj shape; |
| 3234 | rectObj bounds; |
| 3235 | /*OCIDefine *adtp = NULL, *items[QUERY_SIZE] = { NULL };*/ |
| 3236 | OCIDefine *adtp = NULL; |
| 3237 | OCIDefine **items = NULL; |
| 3238 | |
| 3239 | msOracleSpatialLayerInfo *layerinfo = (msOracleSpatialLayerInfo *)layer->layerinfo; |
| 3240 | msOracleSpatialDataHandler *dthand = NULL; |
| 3241 | msOracleSpatialHandler *hand = NULL; |
| 3242 | msOracleSpatialStatement *sthand = NULL; |
| 3243 | |
| 3244 | if (layer->debug) |
| 3245 | msDebug("msOracleSpatialLayerGetExtent was called.\n"); |
| 3246 | |
| 3247 | if (layerinfo == NULL) |
| 3248 | { |
| 3249 | msSetError( MS_ORACLESPATIALERR, "msOracleSpatialLayerGetExtent called on unopened layer","msOracleSpatialLayerGetExtent()"); |
| 3250 | return MS_FAILURE; |
| 3251 | } |
| 3252 | else |
| 3253 | { |
| 3254 | dthand = (msOracleSpatialDataHandler *)layerinfo->oradatahandlers; |
| 3255 | hand = (msOracleSpatialHandler *)layerinfo->orahandlers; |
| 3256 | sthand = (msOracleSpatialStatement *) layerinfo->orastmt; |
| 3257 | } |
| 3258 | |
| 3259 | /* allocate enough space for items */ |
| 3260 | if (layer->numitems > 0) |
| 3261 | { |
| 3262 | sthand->items_query = (item_text_array_query *)malloc( sizeof(item_text_array_query) * (layer->numitems) ); |
| 3263 | if (sthand->items_query == NULL) |
| 3264 | { |
| 3265 | msSetError( MS_ORACLESPATIALERR, "Cannot allocate layerinfo->items buffer", "msOracleSpatialLayerGetExtent()" ); |
| 3266 | return MS_FAILURE; |
| 3267 | } |
| 3268 | items = (OCIDefine **)malloc(sizeof(OCIDefine *)*layer->numitems); |
| 3269 | if (items == NULL) |
| 3270 | { |
| 3271 | msSetError( MS_ORACLESPATIALERR,"Cannot allocate items buffer","msOracleSpatialLayerWhichShapes()" ); |
| 3272 | return MS_FAILURE; |
| 3273 | } |
| 3274 | memset(items ,0,sizeof(OCIDefine *)*layer->numitems); |
| 3275 | } |
| 3276 | |
| 3277 | table_name = (char *) malloc(sizeof(char) * TABLE_NAME_SIZE); |
| 3278 | if (!msSplitData( layer->data, &geom_column_name, &table_name, &unique, &srid, &function, &version )) |
| 3279 | { |
| 3280 | msSetError( MS_ORACLESPATIALERR, |
| 3281 | "Error parsing OracleSpatial DATA variable. Must be: " |
nothing calls this directly
no test coverage detected