Added connection function to get the connection string to the server database

This commit is contained in:
Mario de Frutos
2015-11-11 17:50:22 +01:00
parent 55337efc3a
commit 22239d2da6
2 changed files with 19 additions and 6 deletions

View File

@@ -0,0 +1,16 @@
--
-- Geocoder server connection config
--
-- The purpose of this function is provide to the PL/Proxy functions
-- the connection string needed to connect with the server
CREATE OR REPLACE FUNCTION cdb_geocoder_client._server_conn_str()
RETURNS text AS $$
DECLARE
db_connection_str text;
BEGIN
SELECT cdb_geocoder_client._config_get('db_server_config')->'connection_str' INTO db_connection_str;
SELECT trim(both '"' FROM db_connection_str) INTO db_connection_str;
RETURN db_connection_str;
END;
$$ LANGUAGE 'plpgsql';