-------------------------------------------------------------------- */ msSDEGetLayerInfo */ -------------------------------------------------------------------- */ Get a LayerInfo for the layer. Cached layer is used if it */ exists in the cache. */ ------------------------------------------------
| 361 | /* exists in the cache. */ |
| 362 | /* -------------------------------------------------------------------- */ |
| 363 | long msSDEGetLayerInfo(layerObj *layer, |
| 364 | SE_CONNECTION conn, |
| 365 | char *tableName, |
| 366 | char *columnName, |
| 367 | char *connectionString, |
| 368 | SE_LAYERINFO layerinfo) |
| 369 | { |
| 370 | int i; |
| 371 | long status; |
| 372 | layerId *lid = NULL; |
| 373 | |
| 374 | /* If table or column are null, nothing can be done. */ |
| 375 | if(tableName == NULL) |
| 376 | { |
| 377 | msSetError( MS_MISCERR, |
| 378 | "Missing table name.\n", |
| 379 | "msSDEGetLayerInfo()"); |
| 380 | return (MS_FAILURE); |
| 381 | } |
| 382 | if(columnName == NULL) |
| 383 | { |
| 384 | msSetError( MS_MISCERR, |
| 385 | "Missing column name.\n", |
| 386 | "msSDEGetLayerInfo()"); |
| 387 | return (MS_FAILURE); |
| 388 | } |
| 389 | if(connectionString == NULL) |
| 390 | { |
| 391 | msSetError( MS_MISCERR, |
| 392 | "Missing connection string.\n", |
| 393 | "msSDEGetLayerInfo()"); |
| 394 | return (MS_FAILURE); |
| 395 | } |
| 396 | |
| 397 | if (layer->debug){ |
| 398 | msDebug("%s: Looking for layer by %s, %s, %s\n", |
| 399 | "msSDEGetLayerInfo()", |
| 400 | tableName, |
| 401 | columnName, |
| 402 | connectionString); |
| 403 | } |
| 404 | |
| 405 | /* Search the lcache for the layer id. */ |
| 406 | for(i = 0; i < lcacheCount; i++) |
| 407 | { |
| 408 | lid = lcache + i; |
| 409 | if(strcasecmp(lid->table, tableName) == 0 && |
| 410 | strcasecmp(lid->column, columnName) == 0 && |
| 411 | strcasecmp(lid->connection, connectionString) == 0) |
| 412 | { |
| 413 | status = SE_layer_get_info_by_id(conn, lid->layerId, layerinfo); |
| 414 | if(status != SE_SUCCESS) { |
| 415 | sde_error(status, "msSDEGetLayerInfo()", "SE_layer_get_info()"); |
| 416 | return(MS_FAILURE); |
| 417 | } |
| 418 | if (layer->debug){ |
| 419 | msDebug( "%s: Matched layer to id %i.\n", |
| 420 | "msSDEGetLayerId()", lid->layerId); |
no test coverage detected