25 lines
1.2 KiB
Plaintext
25 lines
1.2 KiB
Plaintext
|
--
|
||
|
-- Public geocoder API function
|
||
|
--
|
||
|
-- These are the only ones with permissions to publicuser role
|
||
|
-- and should also be the only ones with SECURITY DEFINER
|
||
|
|
||
|
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %> (<%= function_signature['argument_data_types'] %>)
|
||
|
RETURNS <%= function_signature['result_data_type'] %> AS $$
|
||
|
DECLARE
|
||
|
ret <%= function_signature['result_data_type'] %>;
|
||
|
BEGIN
|
||
|
-- TODO: this is to be changed according to the feature doc
|
||
|
SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= function_signature['argument_data_types'] %>) INTO ret;
|
||
|
RETURN ret;
|
||
|
END;
|
||
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= function_signature['function_name'] %> (user_id name, tx_id bigint, <%= function_signature['argument_data_types'] %>)
|
||
|
RETURNS Geometry AS $$
|
||
|
CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str();
|
||
|
SELECT cdb_geocoder_server.<%= function_signature['function_name'] %> (user_id, tx_id, function_signature['argument_data_types']);
|
||
|
$$ LANGUAGE plproxy;
|