Previous Next

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, REPLICATION-CREATE, REPLICATION-WRITE, REPLICATION-DELETE, 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, ASSIGN, and WRITE triggers, and not REPLICATION-CREATE, REPLICATION-DELETE, and REPLICATION-WRITE triggers. The DELETE trigger is not disabled.
For more information on database replication, see the reference entry for the RAW-TRANSFER statement, 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.
 
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 VARIABLE ix AS INTEGER NO-UNDO.
 
DEFINE FRAME cust-frame
  Customer.CustNum SKIP
  Customer.Name  SKIP
  Customer.Phone SKIP
  b_more b_exit
  WITH CENTERED SIDE-LABELS ROW 3.
 
DEFINE STREAM cust.
 
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.CustNum 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.
  DISPLAY Customer.CustNum Customer.Name Customer.Phone 
    WITH FRAME cust-frame.
END.
 
ON CHOOSE OF MENU-ITEM dumpit DO:
  DISABLE TRIGGERS FOR DUMP OF Customer.
  ix = 1.
  SESSION:IMMEDIATE-DISPLAY = TRUE.
  OUTPUT STREAM cust TO "Customer.d".
  FOR EACH Customer NO-LOCK:
    EXPORT STREAM cust Customer.
    DISPLAY ix LABEL "Records Processed" 
      WITH FRAME rec-info SIDE-LABELS ROW SCREEN-LINES / 2 CENTERED.
    ix = ix + 1.
    PROCESS EVENTS.
  END.
  SESSION:IMMEDIATE-DISPLAY = FALSE.
  OUTPUT STREAM cust CLOSE. /*
  APPLY "ENTRY" TO b_quit IN FRAME butt-frame. */
END.
 
IF NOT RETRY THEN
  ASSIGN 
    CURRENT-WINDOW:MENUBAR = MENU mbar:HANDLE
    CURRENT-WINDOW:VISIBLE = TRUE.
WAIT-FOR CHOOSE OF MENU-ITEM exit.
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.
    DISPLAY ix LABEL "Records Processed"
      WITH FRAME rec-info SIDE-LABELS ROW SCREEN-LINES / 2 CENTERED.
    ix = ix + 1.
    PROCESS EVENTS.
  END.
  INPUT CLOSE.
  SESSION:IMMEDIATE-DISPLAY = FALSE.
END.
Notes 
*
*
*
*
The Disable Delete Trigger (-disabledeltrig) startup parameter disables the DELETE trigger when ALLOW-REPLICATION is on for the DISABLE TRIGGERS statement or the DISABLE-LOAD-TRIGGER() buffer method. For more information about this parameter, see OpenEdge Deployment: Startup Command and Parameter Reference.
See also 
ON statement, TRIGGER PROCEDURE statement

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.