storenode_int(p_no_comment integer, p_no_id text)

8.121. storenode_int(p_no_comment integer, p_no_id text)

Function Properties

Language: PLPGSQL

Return Type: integer

no_id - Node ID # no_comment - Human-oriented comment Internal function to process the STORE_NODE event for node no_id

declare
	v_old_row		record;
begin
	-- ----
	-- Grab the central configuration lock
	-- ----
	lock table sl_config_lock;

	-- ----
	-- Check if the node exists
	-- ----
	select * into v_old_row
			from sl_node
			where no_id = p_no_id
			for update;
	if found then 
		-- ----
		-- Node exists, update the existing row.
		-- ----
		update sl_node
				set no_comment = p_no_comment
				where no_id = p_no_id;
	else
		-- ----
		-- New node, insert the sl_node row
		-- ----
		insert into sl_node
				(no_id, no_active, no_comment,no_failed) values
				(p_no_id, 'f', p_no_comment,false);
	end if;

	return p_no_id;
end;