Skip to content

Commit

Permalink
Merge branch '3.8' of https://github.com/JumpMind/symmetric-ds.git in…
Browse files Browse the repository at this point in the history
…to 3.8
  • Loading branch information
chenson42 committed Jun 2, 2017
2 parents b1c19a3 + b15da60 commit 3bbb958
Show file tree
Hide file tree
Showing 22 changed files with 659 additions and 7 deletions.
Expand Up @@ -68,6 +68,7 @@ to stream from the source via callback; a value of 0, lob data is captured by th
Capture Lobs:: Provides a hint as to whether this trigger will capture big lobs data. If set to 1 every effort will be made during data capture in trigger and during data selection for
initial load to use lob facilities to extract and store data in the database. On Oracle, this may need to be set to 1 to get around 4k concatenation errors during data capture and during initial load.
Capture Old Data:: Indicates whether this trigger should capture and send the old data (previous state of the row before the change).
Stream Row:: Captures only the primary key when the trigger fires which can reduce the overhead of the trigger on tables with lots of columns. The data will then be queried using the PK values captured when the batch is ready for extraction.
External Select:: Specify a SQL select statement that returns a single row, single column result.
It will be used in the generated database trigger to populate the EXTERNAL_DATA field on the data table. See
Excluded Column Names:: Specify a comma-delimited list of columns that should not be synchronized from this table.
Expand Down
Expand Up @@ -32,7 +32,26 @@ public Db2As400TriggerTemplate(ISymmetricDialect symmetricDialect) {
" $(custom_on_insert_text) " +
" END " );


sqlTemplates.put("insertReloadTriggerTemplate" ,
"CREATE TRIGGER $(schemaName)$(triggerName) " +
" AFTER INSERT ON $(schemaName)$(tableName) " +
" REFERENCING NEW AS NEW " +
" FOR EACH ROW MODE DB2SQL " +
" BEGIN ATOMIC " +
" $(custom_before_insert_text) \n" +
" IF $(syncOnInsertCondition) and $(syncOnIncomingBatchCondition) then " +
" INSERT into $(defaultSchema)$(prefixName)_data " +
" (table_name, event_type, trigger_hist_id, pk_data, channel_id, transaction_id, source_node_id, external_data, create_time) " +
" VALUES('$(targetTableName)', 'R', $(triggerHistoryId), " +
" $(newKeys), " +
" $(channelExpression), $(txIdExpression), $(sourceNodeExpression), " +
" $(externalSelect), " +
" CURRENT_TIMESTAMP); " +
" END IF; " +
" $(custom_on_insert_text) " +
" END " );


sqlTemplates.put("updateTriggerTemplate" ,
"CREATE TRIGGER $(schemaName)$(triggerName) \n"+
" AFTER UPDATE ON $(schemaName)$(tableName) \n"+
Expand All @@ -56,6 +75,27 @@ public Db2As400TriggerTemplate(ISymmetricDialect symmetricDialect) {
" $(custom_on_update_text) \n"+
" END " );

sqlTemplates.put("updateReloadTriggerTemplate" ,
"CREATE TRIGGER $(schemaName)$(triggerName) \n"+
" AFTER UPDATE ON $(schemaName)$(tableName) \n"+
" REFERENCING OLD AS OLD NEW AS NEW \n"+
" FOR EACH ROW MODE DB2SQL \n"+
" BEGIN ATOMIC \n"+
" $(custom_before_update_text) \n" +
" IF $(syncOnUpdateCondition) and $(syncOnIncomingBatchCondition) then \n"+
" INSERT into $(defaultSchema)$(prefixName)_data \n"+
" (table_name, event_type, trigger_hist_id, pk_data, channel_id, transaction_id, source_node_id, external_data, create_time) \n"+
" VALUES('$(targetTableName)', 'R', $(triggerHistoryId), \n"+
" $(oldKeys), \n"+
" $(channelExpression), \n"+
" $(txIdExpression), \n"+
" $(sourceNodeExpression), \n"+
" $(externalSelect), \n"+
" CURRENT_TIMESTAMP); \n"+
" END IF; \n"+
" $(custom_on_update_text) \n"+
" END " );

sqlTemplates.put("deleteTriggerTemplate" ,
"CREATE TRIGGER $(schemaName)$(triggerName) " +
" AFTER DELETE ON $(schemaName)$(tableName) " +
Expand Down

0 comments on commit 3bbb958

Please sign in to comment.