clonenodeprepare_int(integer, integer, text)

6.30. clonenodeprepare_int(integer, integer, text)

Function Properties

Language: PLPGSQL

Return Type: integer

Internal part of cloneNodePrepare().

declare
	p_no_id			alias for $1;
	p_no_provider	alias for $2;
	p_no_comment	alias for $3;
begin
	insert into sl_node
		(no_id, no_active, no_comment)
		select p_no_id, no_active, p_no_comment
		from sl_node
		where no_id = p_no_provider;

	insert into sl_path
		(pa_server, pa_client, pa_conninfo, pa_connretry)
		select pa_server, p_no_id, 'Event pending', pa_connretry
		from sl_path
		where pa_client = p_no_provider;
	insert into sl_path
		(pa_server, pa_client, pa_conninfo, pa_connretry)
		select p_no_id, pa_client, 'Event pending', pa_connretry
		from sl_path
		where pa_server = p_no_provider;

	insert into sl_subscribe
		(sub_set, sub_provider, sub_receiver, sub_forward, sub_active)
		select sub_set, sub_provider, p_no_id, sub_forward, sub_active
		from sl_subscribe
		where sub_receiver = p_no_provider;

	insert into sl_confirm
		(con_origin, con_received, con_seqno, con_timestamp)
		select con_origin, p_no_id, con_seqno, con_timestamp
		from sl_confirm
		where con_received = p_no_provider;

	perform RebuildListenEntries();

	return 0;
end;