====== pears.IQXNetHasPermission ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."IQXNetHasPermission"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "pWebUserID" char(20),in "pRightID" char(20) )
returns smallint
not deterministic
begin
declare "rv" smallint;
set "rv" = 0;
if(select first "isnull"((select first "Assigned" from "IQXNetRightAssigned" where "IQXNetRightID" = "a"."IQXNetRightID" and "IQXNetUserID" = "u"."IQXNetUserID"),0)
+"isnull"((select first 1 from "IQXNetRightDefault" where "IQXNetRightID" = "a"."IQXNetRightID" and "IQXNetUserClassID" = "a"."IQXNetUserClassID" and "ID" = "a"."ID"),0)
from "IQXNetRightAllowed" as "a" join "IQXNetUser" as "u" on "a"."IQXNetUserClassID" = "u"."IQXNetUserClassID" and "a"."ID" = '*'
where "u"."IQXNetUserID" = "pWebUserID" and "a"."IQXNetRightID" = "pRightID") > 0 then
set "rv" = 1
end if;
return "rv"
end