> The manual is a bit skimpy on triggers. Any supplemetal docs around?
>
> We're trying to track updates to a file; individual items have gone missing
> lately. No SQL involvement at all.

Sorry, can't comment on Universe.

For unidata,  here's some brief docs I wrote after digging.  I found info in
'Developing UniBasic Applications'

A trigger is a piece of code (subroutine) that is executed when one of two 
things happens: a record is written (updated) or a record is deleted. These 
two event are separate, that is, the subroutine to execute in each case may 
be different.

Some Unidata trigger commands:

LIST.TRIGGER filename
CREATE.TRIGGER filename subroutine_name UPDATE
CREATE.TRIGGER filename subroutine_name DELETE
DELETE.TRIGGER filename UPDATE
DELETE.TRIGGER filename DELETE

Some trigger notes:

   1. Subroutines for triggers must be globally cataloged. That is:

:CATALOG subroutine_name 

   2. Triggers may only be created/manipulated by the owner of the file at the 
operating system level or have root permissions on UniData.

What you use a trigger subroutine to do is up to you. Here's a sample 
template:

SUBROUTINE subroutine_name(X.EXECSTAT,X.DICT,X.FILE,X.ID,X.REC)
*
* This subroutine MUST BE GLOBALLY CATALOGed!
* JVB Jeff Butera
* H08 Hampshire College
*
* EXECSTAT=2 says to allow the record to be written (when we exit
* this subroutine) but use the record as in X.REC (ie: we may manipulate
* it in this subroutine and it'll use the edited copy, not the original)
*
X.EXECSTAT=2

After that, you're free to do whatever you like in native Unibasic. The 
variable X.REC contains the entire record to be written to the database file 
X.FILE with the ID X.ID. The EXECSTAT variable, when set to 2, allows you to 
possibly manipulate the record in this subroutine before the record is 
updated/deleted.



-- 
Jeff Butera, Ph.D.
Administrative Systems
Hampshire College
[EMAIL PROTECTED]
413-559-5556

"There are 10 kinds of people in the world: those that
  understand binary and those that don't."    Various 
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to