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

Function msSDELCacheAdd

mapsde.c:307–355  ·  view source on GitHub ↗

-------------------------------------------------------------------- */ msSDELCacheAdd */ -------------------------------------------------------------------- */ Adds a SDE layer to the global layer cache. */ -------------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

305/* Adds a SDE layer to the global layer cache. */
306/* -------------------------------------------------------------------- */
307long msSDELCacheAdd( layerObj *layer,
308 SE_LAYERINFO layerinfo,
309 char *tableName,
310 char *columnName,
311 char *connectionString)
312{
313
314 layerId *lid = NULL;
315 long status = 0;
316
317 msAcquireLock( TLOCK_SDE );
318
319 if (layer->debug){
320 msDebug( "%s: Caching id for %s, %s, %s\n", "msSDELCacheAdd()",
321 tableName, columnName, connectionString);
322 }
323
324 /* Ensure the cache is large enough to hold the new item. */
325 if(lcacheCount == lcacheMax)
326 {
327 lcacheMax += 10;
328 lcache = (layerId *)realloc(lcache, sizeof(layerId) * lcacheMax);
329 if(lcache == NULL)
330 {
331 msReleaseLock( TLOCK_SDE );
332 msSetError(MS_MEMERR, NULL, "msSDELCacheAdd()");
333 return (MS_FAILURE);
334 }
335 }
336
337 /* Population the new lcache object. */
338 lid = lcache + lcacheCount;
339 lcacheCount++;
340
341 status = SE_layerinfo_get_id(layerinfo, &lid->layerId);
342 if(status != SE_SUCCESS)
343 {
344 msReleaseLock( TLOCK_SDE );
345 sde_error(status, "msSDELCacheAdd()", "SE_layerinfo_get_id()");
346 return(MS_FAILURE);
347 }
348
349 lid->table = msStrdup(tableName);
350 lid->column = msStrdup(columnName);
351 lid->connection = msStrdup(connectionString);
352
353 msReleaseLock( TLOCK_SDE );
354 return (MS_SUCCESS);
355}
356
357/* -------------------------------------------------------------------- */
358/* msSDEGetLayerInfo */

Callers 1

msSDEGetLayerInfoFunction · 0.85

Calls 6

msAcquireLockFunction · 0.85
msDebugFunction · 0.85
msReleaseLockFunction · 0.85
msSetErrorFunction · 0.85
sde_errorFunction · 0.85
msStrdupFunction · 0.85

Tested by

no test coverage detected