root/sql/sprocs/stratcon.update_config.sql

Revision f4a87edf072c4d9193702519dea7eba52fcb73ff, 1.5 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 4 years ago)

refs #226

This implements the change, but does not improve upon the stratcon config.
The stratcon config is still inserted with 0.0.0.0 as the remote_address
and now furthers the underachievement by using "" as the common name.

This should be fixed as a part of this ticket as well.

  • Property mode set to 100644
Line 
1 --
2 -- Name: update_config(inet, text, timestamp with time zone, xml); Type: FUNCTION; Schema: stratcon; Owner: reconnoiter
3 --
4
5 CREATE FUNCTION stratcon.update_config(v_remote_address_in inet, v_remote_cn_in text, v_node_type_in text, v_whence_in timestamp with time zone, v_config_in xml) RETURNS void
6     AS $$
7 DECLARE
8     v_config xml;
9 BEGIN
10     select config into v_config from stratcon.current_node_config
11      where remote_cn = v_remote_cn_in
12        and node_type = v_node_type_in;
13     IF FOUND THEN
14         IF v_config::text = v_config_in::text THEN
15             RETURN;
16         END IF;
17         delete from stratcon.current_node_config
18               where remote_cn = v_remote_cn_in
19                 and node_type = v_node_type_in;
20     END IF;
21     insert into stratcon.current_node_config
22                 (remote_cn, remote_address, node_type, whence, config)
23          values (v_remote_cn_in, v_remote_address_in, v_node_type_in, v_whence_in, v_config_in);
24     insert into stratcon.current_node_config_changelog
25                 (remote_cn, remote_address, node_type, whence, config)
26          values (v_remote_cn_in, v_remote_address_in, v_node_type_in, v_whence_in, v_config_in);
27 END
28 $$
29     LANGUAGE plpgsql
30 SECURITY DEFINER
31 ;
32
33 ALTER FUNCTION stratcon.update_config(v_remote_address_in inet, v_remote_cn_in text, v_node_type_in text, v_whence_in timestamp with time zone, v_config_in xml) OWNER TO reconnoiter;
34
35 GRANT EXECUTE ON FUNCTION stratcon.update_config(inet, text, text, timestamp with time zone, xml) TO stratcon;
36
Note: See TracBrowser for help on using the browser.