1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
6 Purpose
: Create replication triggers table from the current database
13 Author
(s
) : Andreww McMillan
16 ------------------------------------------------------------------------*/
20 /* _UIB-CODE-BLOCK-END
*/
24 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
26 /* ******************** Preprocessor Definitions
******************** */
28 &Scoped-define PROCEDURE-TYPE Procedure
32 /* _UIB-PREPROCESSOR-BLOCK-END
*/
37 /* *********************** Procedure Settings
************************ */
39 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
40 /* Settings for
THIS-PROCEDURE
44 Add Fields to
: Neither
45 Other Settings
: CODE-ONLY
COMPILE
47 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
49 /* ************************* Create Window
************************** */
51 &ANALYZE-SUSPEND _CREATE-WINDOW
52 /* DESIGN Window definition
(used by the UIB
)
53 CREATE WINDOW Procedure
ASSIGN
56 /* END WINDOW DEFINITION
*/
63 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
66 /* *************************** Main Block
*************************** */
67 DEF VAR trig-list
AS CHAR NO-UNDO INITIAL "".
69 FOR EACH ReplTrigger
: DELETE ReplTrigger.
END.
71 FOR EACH _File
WHERE NOT(_File._File-NAME
BEGINS "_") NO-LOCK:
72 trig-list
= (IF CAN-FIND( FIRST _File-trig
OF _File
WHERE _File-Trig._Event
= "REPLICATION-CREATE") THEN "C" ELSE "")
73 + (IF CAN-FIND( FIRST _File-trig
OF _File
WHERE _File-Trig._Event
= "REPLICATION-WRITE") THEN "M" ELSE "")
74 + (IF CAN-FIND( FIRST _File-trig
OF _File
WHERE _File-Trig._Event
= "REPLICATION-DELETE") THEN "D" ELSE "").
75 RUN make-repl-trigger
( _File._File-name
, trig-list
).
79 /* _UIB-CODE-BLOCK-END
*/
83 /* ********************** Internal Procedures
*********************** */
85 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE make-repl-trigger Procedure
86 PROCEDURE make-repl-trigger
:
87 /*------------------------------------------------------------------------------
89 ------------------------------------------------------------------------------*/
90 DEF INPUT PARAMETER file-name
AS CHAR NO-UNDO.
91 DEF INPUT PARAMETER event
AS CHAR NO-UNDO.
93 FIND ReplTrigger
WHERE ReplTrigger.TableToRepl
= file-name
EXCLUSIVE-LOCK NO-ERROR.
94 IF NOT AVAILABLE(ReplTrigger
) THEN DO:
96 ReplTrigger.TableToRepl
= file-name.
97 ReplTrigger.Activity
= "".
99 ReplTrigger.Activity
= ReplTrigger.Activity
+ event.
103 /* _UIB-CODE-BLOCK-END
*/