| |
751 |
751 |
insert into acs_function_args (function, arg_seq, arg_name, arg_default) |
| |
752 |
752 |
values (upper(trim(p_function)), v_arg_seq, upper(trim(v_arg_name)), v_arg_default); |
| |
753 |
753 |
|
| |
754 |
754 |
v_arg_seq := v_arg_seq + 1; |
| |
755 |
755 |
v_elem = split(p_arg_list, '','', v_arg_seq); |
| |
756 |
756 |
end loop; |
| |
757 |
757 |
|
| |
758 |
758 |
return 1; |
| |
759 |
759 |
end;' language 'plpgsql'; |
| |
760 |
760 |
|
| |
761 |
761 |
|
| |
762 |
762 |
|
| |
763 |
763 |
|
| |
764 |
764 |
create function trigger_type (integer) returns varchar as ' |
| |
765 |
765 |
declare |
| |
766 |
766 |
tgtype alias for $1; |
| |
767 |
767 |
description varchar; |
| |
768 |
768 |
sep varchar; |
| |
769 |
769 |
begin |
| |
770 |
770 |
|
| |
771 |
|
if tgtype & 2 then |
| |
|
771 |
if (tgtype & 2) > 0 then |
| |
772 |
772 |
description := ''BEFORE ''; |
| |
773 |
773 |
else |
| |
774 |
774 |
description := ''AFTER ''; |
| |
775 |
775 |
end if; |
| |
776 |
776 |
|
| |
777 |
777 |
sep := ''''; |
| |
778 |
778 |
|
| |
779 |
|
if tgtype & 4 then |
| |
|
779 |
if (tgtype & 4) > 0 then |
| |
780 |
780 |
description := description || ''INSERT ''; |
| |
781 |
781 |
sep := ''OR ''; |
| |
782 |
782 |
end if; |
| |
783 |
783 |
|
| |
784 |
|
if tgtype & 8 then |
| |
|
784 |
if (tgtype & 8) > 0 then |
| |
785 |
785 |
description := description || sep || ''DELETE ''; |
| |
786 |
786 |
sep := ''OR ''; |
| |
787 |
787 |
end if; |
| |
788 |
788 |
|
| |
789 |
|
if tgtype & 16 then |
| |
|
789 |
if (tgtype & 16) > 0 then |
| |
790 |
790 |
description := description || sep || ''UPDATE ''; |
| |
791 |
791 |
sep := ''OR ''; |
| |
792 |
792 |
end if; |
| |
793 |
793 |
|
| |
794 |
|
if tgtype & 1 then |
| |
|
794 |
if (tgtype & 1) > 0 then |
| |
795 |
795 |
description := description || ''FOR EACH ROW''; |
| |
796 |
796 |
else |
| |
797 |
797 |
description := description || ''STATEMENT''; |
| |
798 |
798 |
end if; |
| |
799 |
799 |
|
| |
800 |
800 |
return description; |
| |
801 |
801 |
|
| |
802 |
802 |
end;' language 'plpgsql' with (iscachable); |
| |
803 |
803 |
|