Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread 2.16b2 - OLDROW and INSERT triggers / short-circuit boolean evaluation
Sun, Mar 30 2014 7:33 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I would like to be able to access OLDROW values in ALL triggers / have short-circuit boolean testing working.

---------------------------
Debugger Exception Notification
---------------------------
Project Diabetes.exe raised exception class EEDBError with message 'ElevateDB Error #1011 An error occurred with the row OLDROW (The row value cannot be referenced in an INSERT operation)'.
---------------------------
Break   Continue   Help  
---------------------------

CREATE TRIGGER "SetAllValues" BEFORE ALL
ON "BloodTests"
BEGIN
IF OPERATION <> 'DELETE' THEN
IF ((OPERATION = 'INSERT') AND (NEWROW._mmolPERl IS NOT NULL)) OR (NEWROW._mmolPERl <> OLDROW._mmolPERl) THEN
 SET NEWROW._mgPERdl = CAST(NEWROW._mmolPERl * 18.0182 AS INTEGER);
ELSE
 SET NEWROW._mmolPERl = TRUNCATE(NEWROW._mgPERdl / 18.0182, 1);
END IF;
END IF;
END


Roy Lambert
Wed, Apr 2 2014 7:05 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< I would like to be able to access OLDROW values in ALL triggers / have
short-circuit boolean testing working. >>

INSERT triggers do not have an OLDROW - it doesn't exist.  And short-circuit
boolean testing is a *runtime* decision, not a compile-time decision.  IOW,
boolean short-circuiting doesn't cause the compiler to skip over certain
parts of the code.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Apr 3 2014 2:49 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


>INSERT triggers do not have an OLDROW - it doesn't exist.

I know and I would expect OLDROW to return NULL for all columns

>And short-circuit
>boolean testing is a *runtime* decision, not a compile-time decision. IOW,
>boolean short-circuiting doesn't cause the compiler to skip over certain
>parts of the code.

OK bad thinking on my part there, I was assuming that OLDROW might not be populated for INSERT triggers not that it just didn't exist.

Roy
Image