Merge pull request #25 from CartoDB/add-config-table-and-funcs
Config table and functions for server extension
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
-- Create a conf table
|
||||
SELECT cdb_geocoder_server._config_set('cds', '{"Manolo Escobar": {"El Limonero":"En stock", "Viva el vino":"Sin stock"}}');
|
||||
_config_set
|
||||
-------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Test key retrieval
|
||||
SELECT cdb_geocoder_server._config_get('cds');
|
||||
_config_get
|
||||
----------------------------------------------------------------------------
|
||||
{"Manolo Escobar": {"El Limonero":"En stock", "Viva el vino":"Sin stock"}}
|
||||
(1 row)
|
||||
|
||||
-- Test returns NULL if key doesn't exist
|
||||
SELECT cdb_geocoder_server._config_get('no existe');
|
||||
_config_get
|
||||
-------------
|
||||
|
||||
(1 row)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
-- Create a conf table
|
||||
CREATE TABLE conf (key TEXT PRIMARY KEY, values_json TEXT NOT NULL);
|
||||
INSERT INTO conf VALUES ('cds', '{"Manolo Escobar": {"El Limonero":"En stock", "Viva el vino":"Sin stock"}}');
|
||||
-- Test key retrieval
|
||||
SELECT cdb_geocoder_server._get_conf('cds');
|
||||
_get_conf
|
||||
----------------------------------------------------------------------------
|
||||
{"Manolo Escobar": {"El Limonero":"En stock", "Viva el vino":"Sin stock"}}
|
||||
(1 row)
|
||||
|
||||
-- Test no key exception
|
||||
SELECT cdb_geocoder_server._get_conf('no existe');
|
||||
ERROR: Missing key 'no existe' in conf table
|
||||
-- Drop conf table
|
||||
DROP TABLE conf;
|
||||
Reference in New Issue
Block a user