====== pears.WPKTrackChange ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."WPKTrackChange"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "sTrackerType" char(1),in "sTrackerID" char(50) )
begin
if "strackertype" is null or "strackerid" is null then
return
end if;
if "left"("strackerid",1) = '#' then
set "strackerid" = "right"("strackerid","length"("strackerid")-1)
end if;
if exists(select "wpkchangetrackerid" from "wpkchangetracker" where "wpkchangetrackertype" = "strackertype" and "wpkchangetrackerid" = "strackerid") then
update "wpkchangetracker" set "clickcount" = (if "clickcount" between-2 and-1 then 1 else "clickcount"+1 endif) where "wpkchangetrackertype" = "strackertype" and "wpkchangetrackerid" = "strackerid"
else
insert into "wpkchangetracker"( "wpkchangetrackertype","wpkchangetrackerid","clickcount" ) values( "strackertype","strackerid",1 )
end if
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."WPKTrackChange" IS
{create procedure WPKTrackChange
/* Application Maintained Function / Procedure - DO NOT EDIT*/
(in sTrackerType char(1),in sTrackerID char(50))
begin
if strackertype is null or strackerid is null then
return
end if;
if left(strackerid,1)='#' then
set strackerid=right(strackerid,length(strackerid)-1)
end if;
if exists(select wpkchangetrackerid from wpkchangetracker where wpkchangetrackertype = strackertype and wpkchangetrackerid = strackerid) then
update wpkchangetracker set clickcount = (if clickcount between -2 and -1 then 1 else clickcount+1 endif) where wpkchangetrackertype = strackertype and wpkchangetrackerid = strackerid
else
insert into wpkchangetracker(wpkchangetrackertype,wpkchangetrackerid,clickcount) values (strackertype,strackerid,1)
end if
end
}