====== pears.NetDefineProcs ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetDefineProcs"(
/* DOC
Created: 06/01/2015
Updated: 03/05/2016
Details: Fetches the procedures and generates the documentation for themit will also fetch just one procedure when pSelectOne is not nullIN
- pSearchTerm - The search string
- pSelectOne - if is not null will return the first item
OUT
- procccessName - Name of the procedure
- paramName - Name of the parameter (both inputs and outputs listed)
- paramIO - Determines if the paramater is an input or output (0=IN | 1-OUT)
- paramID - The order that the params come within the procedure (1=FIRST | >1 LAST)
- paramDefault - The default value of that parameter
- paramType - The datatype of that param
Author: Gareth
Version: 1.2
*/
in "pWebUserID" char(20),in "pSearchTerm" long varchar,in "pSelectOne" char(1) default null )
result( "proccessName" long varchar,"Doc" long varchar,"paramName" long varchar,"paramIO" long varchar,"paramDefault" long varchar,"paramType" long varchar )
begin
select "proc_name" as "proccessName",
(select "substr"("source","charindex"('/* DOC',"source")+6,"charindex"('*/',"source")-"charindex"('/* DOC',"source")-6) from "sys"."sysprocedure" where "proc_name" = "proccessName" and "charindex"('/* DOC',"source") > 0) as "Doc",
"LIST"("parm_name" order by "parm_type" asc,"parm_id" asc) as "paramName",
"LIST"("parm_type" order by "parm_type" asc,"parm_id" asc) as "paramIO",
"LIST"("isnull"("default",'null') order by "parm_type" asc,"parm_id" asc) as "paramDefault",
"LIST"("isnull"("domain_name",'null') order by "parm_type" asc,"parm_id" asc) as "paramType"
from "sys"."sysprocedure" as "pr" key join "SYS"."SYSPROCPARM" as "pa" key join "SYS"."SYSDOMAIN"
-- Below code requires sybase 16 - temporary version 11 friendly version above
-- "LIST"("isnull"("base_type_str",'null') order by "parm_type" asc,"parm_id" asc) as "paramType"
-- from "sys"."sysprocedure" as "pr" key join "SYS"."SYSPROCPARM" as "pa" --where pr.proc_name = o.proc_name ;
-- WHERE "proc_name" like 'net%' AND "proc_name" like '%' + pSearchTerm + '%'
where(("pSelectOne" is not null and "proc_name" = "pSearchTerm" and "proc_name" like 'net%') or("pSelectOne" is null and "proc_name" like 'net%' and "proc_name" like '%'+"pSearchTerm"+'%'))
group by "proc_name"
order by 1 asc
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetDefineProcs" IS
{create PROCEDURE pears."NetDefineProcs"
/* DOC
Created: 06/01/2015
Updated: 03/05/2016
Details: Fetches the procedures and generates the documentation for themit will also fetch just one procedure when pSelectOne is not nullIN
- pSearchTerm - The search string
- pSelectOne - if is not null will return the first item
OUT
- procccessName - Name of the procedure
- paramName - Name of the parameter (both inputs and outputs listed)
- paramIO - Determines if the paramater is an input or output (0=IN | 1-OUT)
- paramID - The order that the params come within the procedure (1=FIRST | >1 LAST)
- paramDefault - The default value of that parameter
- paramType - The datatype of that param
Author: Gareth
Version: 1.2
*/
( in "pWebUserID" char(20), in "pSearchTerm" long varchar, in "pSelectOne" char(1) default null)
result( "proccessName" long varchar, "Doc" long varchar, "paramName" long varchar,"paramIO" long varchar,"paramDefault" long varchar,"paramType" long varchar )
begin
SELECT "proc_name" as "proccessName",
(SELECT substr(source, charindex('/* DOC', source)+6, charindex('*/', source) - charindex('/* DOC', source)-6 ) FROM "sys"."sysprocedure" where "proc_name" = "proccessName" AND charindex('/* DOC', source) > 0) as "Doc",
"LIST"("parm_name" order by "parm_type" asc,"parm_id" asc) as "paramName",
"LIST"("parm_type" order by "parm_type" asc,"parm_id" asc) as "paramIO",
"LIST"("isnull"("default",'null') order by "parm_type" asc,"parm_id" asc) as "paramDefault",
"LIST"("isnull"("domain_name",'null') order by "parm_type" asc,"parm_id" asc) as "paramType"
from "sys"."sysprocedure" as "pr" key join "SYS"."SYSPROCPARM" as "pa" key join "SYS"."SYSDOMAIN"
-- Below code requires sybase 16 - temporary version 11 friendly version above
-- "LIST"("isnull"("base_type_str",'null') order by "parm_type" asc,"parm_id" asc) as "paramType"
-- from "sys"."sysprocedure" as "pr" key join "SYS"."SYSPROCPARM" as "pa" --where pr.proc_name = o.proc_name ;
-- WHERE "proc_name" like 'net%' AND "proc_name" like '%' + pSearchTerm + '%'
WHERE (pSelectOne IS NOT NULL and "proc_name" = pSearchTerm and "proc_name" like 'net%') or (pSelectOne IS NULL and "proc_name" like 'net%' AND "proc_name" like '%' + pSearchTerm + '%')
group by "proc_name"
order by 1 asc
end
}