-- -- pa_album__new/16 -- create or replace function pa_album__new( character varying, integer, integer, boolean, integer, character varying, character varying, character varying, text, character varying, integer, timestamp with time zone, character varying, integer, timestamp with time zone, character varying ) returns int4 as $$ declare new__name alias for $1; new__album_id alias for $2; new__parent_id alias for $3; -- default null new__is_live alias for $4; -- default f new__creation_user alias for $5; -- default null new__creation_ip alias for $6; -- default null new__title alias for $7; -- default null new__description alias for $8; -- default null new__story alias for $9; -- default null new__photographer alias for $10; -- default null new__revision_id alias for $11; -- default null new__creation_date alias for $12; -- default now() new__locale alias for $13; -- default null new__context_id alias for $14; -- default null new__publish_date alias for $15; -- default now() new__nls_language alias for $16; -- default null -- if we ever need another parameter space creation_date is the best bet -- new__creation_date timestamp default now(); new__content_type varchar default 'pa_album'; new_relation_tag varchar default null; new__mime_type varchar default null; v_item_id integer; v_revision_id integer; begin v_item_id := content_item__new ( new__name, new__parent_id, new__album_id, new__locale, new__creation_date, new__creation_user, new__context_id, new__creation_ip, 'content_item', new__content_type, null, null, null, null, null ); -- not needed in the new call to content_item__new -- new__relation_tag, v_revision_id := content_revision__new ( new__title, new__description, new__publish_date, new__mime_type, new__nls_language, null, v_item_id, new__revision_id, new__creation_date, new__creation_user, new__creation_ip ); insert into pa_albums (pa_album_id, story, photographer) values (v_revision_id, new__story, new__photographer); if new__is_live = 't' then PERFORM content_item__set_live_revision (v_revision_id); end if; return v_item_id; end; $$ language plpgsql;