Subject | Output params return zeros |
---|---|
Author | Mark Deibert |
Post date | 2005-07-31T02:57:27Z |
In this procedure the Update line works as expected--The row in the table is
updated with the newly calculated values. The calculated values are stored
in the named output params, however in the application the parameters all
contain zeros.
How can the exact same variables update the table correctly but return
zeros to the app?
Thank you very much for looking. I greatly appreciate your help :-)
Mark :-)
ALTER PROCEDURE SP_DICEMARCH (
DIEKEY INTEGER,
MARCHX INTEGER,
MARCHY INTEGER)
RETURNS (
RESULT INTEGER,
NEWMAPX INTEGER,
NEWMAPY INTEGER,
NEWX INTEGER,
NEWY INTEGER)
AS
DECLARE VARIABLE OLDMAPX INTEGER;
DECLARE VARIABLE OLDMAPY INTEGER;
DECLARE VARIABLE OLDX INTEGER;
DECLARE VARIABLE OLDY INTEGER;
DECLARE VARIABLE MOVED INTEGER;
DECLARE VARIABLE SPEED INTEGER;
begin
select MAPX,MAPY,PIXELX,PIXELY,MOVED,SPEED from DICE
where PKEY=:diekey
into :oldmapx,:oldmapy,:oldx,:oldy,:moved,:speed;
if (:moved < :speed) then
begin
result = 1;
newmapx = :oldmapx + :marchx;
newmapy = :oldmapy + :marchy;
newx = :oldx + (:marchx * 40);
newy = :oldy + (:marchy * 40);
update DICE set
MAPX=:newmapx,
MAPY=:newmapy,
PIXELX=:newx,
PIXELY=:newy,
MOVED=MOVED+1
where PKEY=:diekey;
end
else
result = 0;
newmapx = 0;
newmapy = 0;
newx = 0;
newy = 0;
suspend;
end
[Non-text portions of this message have been removed]
updated with the newly calculated values. The calculated values are stored
in the named output params, however in the application the parameters all
contain zeros.
How can the exact same variables update the table correctly but return
zeros to the app?
Thank you very much for looking. I greatly appreciate your help :-)
Mark :-)
ALTER PROCEDURE SP_DICEMARCH (
DIEKEY INTEGER,
MARCHX INTEGER,
MARCHY INTEGER)
RETURNS (
RESULT INTEGER,
NEWMAPX INTEGER,
NEWMAPY INTEGER,
NEWX INTEGER,
NEWY INTEGER)
AS
DECLARE VARIABLE OLDMAPX INTEGER;
DECLARE VARIABLE OLDMAPY INTEGER;
DECLARE VARIABLE OLDX INTEGER;
DECLARE VARIABLE OLDY INTEGER;
DECLARE VARIABLE MOVED INTEGER;
DECLARE VARIABLE SPEED INTEGER;
begin
select MAPX,MAPY,PIXELX,PIXELY,MOVED,SPEED from DICE
where PKEY=:diekey
into :oldmapx,:oldmapy,:oldx,:oldy,:moved,:speed;
if (:moved < :speed) then
begin
result = 1;
newmapx = :oldmapx + :marchx;
newmapy = :oldmapy + :marchy;
newx = :oldx + (:marchx * 40);
newy = :oldy + (:marchy * 40);
update DICE set
MAPX=:newmapx,
MAPY=:newmapy,
PIXELX=:newx,
PIXELY=:newy,
MOVED=MOVED+1
where PKEY=:diekey;
end
else
result = 0;
newmapx = 0;
newmapy = 0;
newx = 0;
newy = 0;
suspend;
end
[Non-text portions of this message have been removed]