Skip to content
Permalink
Browse files

RFC121: Support for dimensions in PostgreSQL (#184)

  • Loading branch information...
tbonfort committed Jan 23, 2018
1 parent 69f0471 commit aeda6dee3cd3412407f0be47b2e10739bbd364bb
Showing with 423 additions and 9 deletions.
  1. +25 −1 CMakeLists.txt
  2. +1 −0 include/mapcache-config.h.in
  3. +2 −2 include/mapcache.h
  4. +2 −0 lib/configuration_xml.c
  5. +357 −0 lib/dimension_pg.c
  6. +1 −2 lib/dimension_sqlite.c
  7. +2 −2 lib/dimension_time.c
  8. +4 −1 lib/service_wms.c
  9. +29 −1 mapcache.xml
@@ -85,7 +85,8 @@ endif()

#options suported by the cmake builder
option(WITH_PIXMAN "Use pixman for SSE optimized image manipulations" ON)
option(WITH_SQLITE "Use sqlite as a cache backend" ON)
option(WITH_SQLITE "Use sqlite as a cache/dimension backend" ON)
option(WITH_POSTGRESQL "Use sqlite as a dimension backend" OFF)
option(WITH_BERKELEY_DB "Use Berkeley DB as a cache backend" OFF)
option(WITH_MEMCACHE "Use memcache as a cache backend (requires recent apr-util)" OFF)
option(WITH_TIFF "Use TIFFs as a cache backend" OFF)
@@ -198,6 +199,28 @@ if(WITH_SQLITE)
endif(SQLITE_FOUND)
endif (WITH_SQLITE)

if(WITH_POSTGRESQL)
find_package(PostgreSQL)
if(PostgreSQL_FOUND)
include_directories(${PostgreSQL_INCLUDE_DIR})
target_link_libraries(mapcache ${PostgreSQL_LIBRARY})
set (USE_POSTGRESQL 1)
else(POSTGRESQL_FOUND)
report_optional_not_found(POSTGRESQL)
endif(PostgreSQL_FOUND)
endif (WITH_POSTGRESQL)

if(WITH_SQLITE)
find_package(SQLITE)
if(SQLITE_FOUND)
include_directories(${SQLITE_INCLUDE_DIR})
target_link_libraries(mapcache ${SQLITE_LIBRARY})
set (USE_SQLITE 1)
else(SQLITE_FOUND)
report_optional_not_found(SQLITE)
endif(SQLITE_FOUND)
endif (WITH_SQLITE)

if(WITH_BERKELEY_DB)
if(NOT BERKELEYDB_FIND_VERSION)
set(BERKELEYDB_FIND_VERSION "4.6")
@@ -305,6 +328,7 @@ message(STATUS " * Apr: ${APR_LIBRARY}")
message(STATUS " * Optional components")
status_optional_component("PIXMAN" "${USE_PIXMAN}" "${PIXMAN_LIBRARY}")
status_optional_component("SQLITE" "${USE_SQLITE}" "${SQLITE_LIBRARY}")
status_optional_component("POSTGRESQL" "${USE_POSTGRESQL}" "${PostgreSQL_LIBRARY}")
status_optional_component("Berkeley DB" "${USE_BDB}" "${BERKELEYDB_LIBRARY}")
status_optional_component("Memcache" "${USE_MEMCACHE}" "${APU_LIBRARY}")
status_optional_component("TIFF" "${USE_TIFF}" "${TIFF_LIBRARY}")
@@ -4,6 +4,7 @@
#cmakedefine USE_PIXMAN 1
#cmakedefine USE_FASTCGI 1
#cmakedefine USE_SQLITE 1
#cmakedefine USE_POSTGRESQL 1
#cmakedefine USE_BDB 1
#cmakedefine USE_MEMCACHE 1
#cmakedefine USE_TIFF 1
@@ -115,8 +115,7 @@ typedef struct mapcache_locker mapcache_locker;
typedef enum {
MAPCACHE_DIMENSION_VALUES,
MAPCACHE_DIMENSION_REGEX,
MAPCACHE_DIMENSION_INTERVALS,
MAPCACHE_DIMENSION_TIME,
MAPCACHE_DIMENSION_POSTGRESQL,
MAPCACHE_DIMENSION_SQLITE
} mapcache_dimension_type;

@@ -1601,6 +1600,7 @@ struct mapcache_dimension {

mapcache_dimension* mapcache_dimension_values_create(mapcache_context *ctx, apr_pool_t *pool);
mapcache_dimension* mapcache_dimension_sqlite_create(mapcache_context *ctx, apr_pool_t *pool);
mapcache_dimension* mapcache_dimension_postgresql_create(mapcache_context *ctx, apr_pool_t *pool);
mapcache_dimension* mapcache_dimension_regex_create(mapcache_context *ctx, apr_pool_t *pool);
mapcache_dimension* mapcache_dimension_time_create(mapcache_context *ctx, apr_pool_t *pool);

@@ -70,6 +70,8 @@ void parseDimensions(mapcache_context *ctx, ezxml_t node, mapcache_tileset *tile
dimension = mapcache_dimension_values_create(ctx,ctx->pool);
} else if(!strcmp(type,"regex")) {
dimension = mapcache_dimension_regex_create(ctx,ctx->pool);
} else if(!strcmp(type,"postgresql")) {
dimension = mapcache_dimension_postgresql_create(ctx,ctx->pool);
} else if(!strcmp(type,"sqlite")) {
dimension = mapcache_dimension_sqlite_create(ctx,ctx->pool);
} else if(!strcmp(type,"time")) {

0 comments on commit aeda6de

Please sign in to comment.
You can’t perform that action at this time.