Christopher B. Browne's Home Page
cbbrowne@acm.org

8.121. storeset_int(integer, integer, text)

Function Properties

PLPGSQLinteger
storeSet_int (set_id, set_origin, set_comment) Process the STORE_SET event, indicating the new set with given ID, origin node, and human readable comment.
    declare
    	p_set_id			alias for $1;
    	p_set_origin		alias for $2;
    	p_set_comment		alias for $3;
    	v_dummy				int4;
    begin
    	-- ----
    	-- Grab the central configuration lock
    	-- ----
    	lock table sl_config_lock;
    
    	select 1 into v_dummy
    			from sl_set
    			where set_id = p_set_id
    			for update;
    	if found then 
    		update sl_set
    				set set_comment = p_set_comment
    				where set_id = p_set_id;
    	else
    		if not exists (select 1 from sl_node
    						where no_id = p_set_origin) then
    			perform storeNode_int (p_set_origin, '<event pending>');
    		end if;
    		insert into sl_set
    				(set_id, set_origin, set_comment) values
    				(p_set_id, p_set_origin, p_set_comment);
    	end if;
    
    	-- Run addPartialLogIndices() to try to add indices to unused sl_log_? table
    	perform addPartialLogIndices();
    
    	return p_set_id;
    end;

Google
Contact me at cbbrowne@acm.org