Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## DISABLE TRIGGERS statement

> Disables database triggers before you perform a dump or load procedure. You must have CAN-DUMP and CAN-LOAD permissions on the table for which you want to disable the triggers.

> #### Syntax

>     DISABLE TRIGGERS FOR { DUMP | LOAD } OF table-name
>       [ ALLOW-REPLICATION ]

> `DUMP`

> Disabling triggers for DUMP disables the trigger associated with the FIND event for the named table.

> `LOAD`

> Disabling triggers for LOAD disables all triggers associated with the CREATE, WRITE, and ASSIGN events for the named table.

> ``table-name``

> The name of the table for which you want to disable the triggers. You can name only one table.

> `ALLOW-REPLICATION`

> Tells DISABLE TRIGGERS to disable only CREATE, DELETE, ASSIGN, and WRITE triggers, and not REPLICATION-CREATE, REPLICATION-DELETE, and REPLICATION-WRITE triggers.

> For more information on database replication, see the reference entry for the RAW-TRANSFER statement in this book, and OpenEdge Data Management: Database Administration .

> Example

> The following example lets you dump or load the contents of a database table. The procedure uses the DISABLE TRIGGERS statement to disable the appropriate triggers before each dump or load operation.

> r-dstrig.p
>     DEFINE SUB-MENU file
>       MENU-ITEM viewit LABEL "&View Data"
>       MENU-ITEM dumpit LABEL "&Dump Data"
>       MENU-ITEM loadit LABEL "&Load Data".
>       MENU-ITEM exit   LABEL "E&xit".

>     DEFINE MENU mbar MENUBAR
>       SUB-MENU file LABEL "&File".

>     DEFINE BUTTON b_more LABEL "Next".
>     DEFINE BUTTON b_exit LABEL "Cancel".

>     DEFINE FRAME cust-frame
>       customer.cust-num SKIP
>       customer.name  SKIP
>       customer.phone SKIP
>       b_more b_exit
>       WITH CENTERED SIDE-LABELS ROW 3.

>     DEFINE STREAM cust.

>     DEFINE VARIABLE i AS INTEGER NO-UNDO.

>     PAUSE 0 BEFORE-HIDE.

>     ON CHOOSE OF b_exit IN FRAME cust-frame
>     DO:
>       HIDE FRAME cust-frame NO-PAUSE.
>       DISABLE ALL WITH FRAME cust-frame.
>       LEAVE.
>     END.

>     ON CHOOSE OF b_more IN FRAME cust-frame
>     DO:
>       FIND NEXT customer NO-LOCK NO-ERROR.
>       IF NOT AVAILABLE(customer) THEN
>         RETURN.
>       DISPLAY customer.cust-num customer.name customer.phone
>         WITH FRAME cust-frame.
>     END.
>     ON CHOOSE OF MENU-ITEM viewit
>     DO:
>       ENABLE ALL WITH FRAME cust-frame.
>       FIND FIRST customer NO-LOCK NO-ERROR.
>       DISP customer.cust-num customer.name customer.phone
>         WITH FRAME cust-frame.
>     END.

>     ON CHOOSE OF MENU-ITEM dumpit
>     DO:
>       DISABLE TRIGGERS FOR DUMP OF customer.
>       i = 1.
>       SESSION:IMMEDIATE-DISPLAY = TRUE.
>       OUTPUT STREAM cust TO "customer.d".
>       FOR EACH customer NO-LOCK:
>         EXPORT STREAM cust customer.
>         DISP i LABEL "Records Processed"
>           WITH FRAME rec-info SIDE-LABELS ROW SCREEN-LINES / 2 CENTERED.
>         i = i + 1.
>         PROCESS EVENTS.
>       END.
>       SESSION:IMMEDIATE-DISPLAY = FALSE.
>       OUTPUT STREAM cust CLOSE. /*
>       APPLY "ENTRY" TO b_quit IN FRAME butt-frame. */
>     END.

>     ON CHOOSE OF MENU-ITEM loadit
>     DO:
>       DISABLE TRIGGERS FOR LOAD OF customer.
>       INPUT FROM "customer.d".
>       SESSION:IMMEDIATE-DISPLAY = TRUE.
>       REPEAT:
>         CREATE customer.
>         IMPORT customer.
>         DISP i LABEL "Records Processed"
>           WITH FRAME rec-info SIDE-LABELS ROW SCREEN-LINES / 2 CENTERED.
>         i = i + 1.
>         PROCESS EVENTS.
>       END.
>       INPUT CLOSE.
>       SESSION:IMMEDIATE-DISPLAY = FALSE.
>     END.

>     IF NOT RETRY THEN
>        ASSIGN CURRENT-WINDOW:MENUBAR = MENU mbar:HANDLE
>               CURRENT-WINDOW:VISIBLE = TRUE.
>     WAIT-FOR CHOOSE OF MENU-ITEM exit.

> #### Notes

> - You also can disable database triggers from the Data Dictionary.

> - Triggers disabled with the DISABLE TRIGGERS statement remain disabled for the duration of the procedure in which you issued the statement and any subprocedures.

> - The OpenEdge Data Dictionary automatically disables the appropriate triggers during data dump and load operations.

> #### See also

> ON statement, TRIGGER PROCEDURE statement

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095