Hi

Look at Universe SQL reference !

CREATE/DROP TRIGGER ... (use the complete syntax even if you don't use SQL Schema or even your file is not a SQL table)

LIST.SICA (to look the trigger defn linked to a file)

Your file must be fully closed when you create/drop a trigger.
Your Subroutine must be global catalogued

Don't move at binary level a file with trigger definition. > universe core dump

There is a little bug : when you DROP the trigger, the SICA info are not completely clean and you get problems to uvbackup/uvrestore the file. (solver recently 10.1.16)

sample subroutine for update log on a file

.X
01 CT BP SUBR.TRIGGER.UPDATE

    SUBROUTINE SUBR.TRIGGER.UPDATE(trigger.name,
       schema,
       table,
       event,
       time,
       new.recordID,
       new.record,
       old.recordID,
       old.record,
       association,
       association.event,
       count,
       chain.cascade,
       cascade)

    OPEN "FTRIGGER.UPDATE" TO FILE  ON ERROR RETURN ELSE RETURN
    KEY.TRIGGER = trigger.name
    KEY.TRIGGER := "_":DATE():"_":TIME()
1     READU REC.TRIGGER FROM FILE,KEY.TRIGGER
       ON ERROR RETURN
       LOCKED GOTO 1
    THEN
    REC.TRIGGER<1> = @LOGNAME
    REC.TRIGGER<2> = @WHO
    REC.TRIGGER<3> = @SENTENCE
    REC.TRIGGER<4> = @PARASENTENCE
    REC.TRIGGER<5> = ''
    REC.TRIGGER<6> = @TTY:" ":@USERNO
    REC.TRIGGER<7> = TIMEDATE()
    REC.TRIGGER<8> = @COMMAND
    REC.TRIGGER<9> = table
    REC.TRIGGER<10> = new.recordID
    REC.TRIGGER<11> = new.record
    WRITE REC.TRIGGER TO FILE,KEY.TRIGGER ON ERROR RETURN  ELSE RETURN

    RETURN
 END


I hope this help.

Manu
----- Original Message ----- From: "Pamela J Robbins" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 03, 2006 4:30 PM
Subject: [U2] Triggers


Does anyone know where I might find good documentation on triggers? I haven't
worked with them before and the UniVerse manuals don't have much
documentation.

--
Pamela J Robbins University of Pennsylvania Sr Programmer/Analyst School of Veterinary Medicine mailto: [EMAIL PROTECTED] New Bolton Center 610-444-5800 610-925-6438 Computer help, ext HELP (4357)
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to