Skip to content

Commit

Permalink
0002766: Version 3.8.3 : Symmtric DS Installation on Interbase
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwellpettit committed Apr 12, 2017
1 parent 228a1b2 commit fd50a9b
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 407 deletions.
Expand Up @@ -42,9 +42,9 @@ public class InterbaseSymmetricDialect extends AbstractSymmetricDialect implemen

public static final String CONTEXT_TABLE_NAME = "context";

static final String CONTEXT_TABLE_CREATE = "create global temporary table %s (id varchar(30), context_value varchar(30)) on commit preserve rows";
static final String CONTEXT_TABLE_CREATE = "create global temporary table %s (name varchar(30), context_value varchar(30)) on commit preserve rows";

static final String CONTEXT_TABLE_INSERT = "insert into %s (id, context_value) values (?, ?)";
static final String CONTEXT_TABLE_INSERT = "insert into %s (name, context_value) values (?, ?)";

static final String SYNC_TRIGGERS_DISABLED_USER_VARIABLE = "sync_triggers_disabled";

Expand Down
Expand Up @@ -44,20 +44,20 @@ public InterbaseTriggerTemplate(ISymmetricDialect symmetricDialect) {
sqlTemplates = new HashMap<String,String>();
sqlTemplates.put("insertTriggerTemplate" ,
"create trigger $(triggerName) for $(schemaName)$(tableName) after insert as " +
" declare variable id integer; " +
" declare variable name integer; " +
" declare variable sync_triggers_disabled varchar(30); " +
" declare variable sync_node_disabled varchar(30); " +
" begin " +
" select context_value from $(prefixName)_context where id = 'sync_triggers_disabled' into :sync_triggers_disabled; " +
" select context_value from $(prefixName)_context where name = 'sync_triggers_disabled' into :sync_triggers_disabled; " +
" $(custom_before_insert_text) \n" +
" if ($(syncOnInsertCondition) and $(syncOnIncomingBatchCondition)) then " +
" begin " +
" select context_value from $(prefixName)_context where id = 'sync_node_disabled' into :sync_node_disabled; " +
" select gen_id($(defaultSchema)GEN_$(prefixName)_data_data_id, 1) from rdb$database into :id; " +
" select context_value from $(prefixName)_context where name = 'sync_node_disabled' into :sync_node_disabled; " +
" select gen_id($(defaultSchema)GEN_$(prefixName)_data_data_id, 1) from rdb$database into :name; " +
" insert into $(defaultSchema)$(prefixName)_data " +
" (data_id, table_name, event_type, trigger_hist_id, row_data, channel_id, transaction_id, source_node_id, external_data, create_time) " +
" values( " +
" :id, " +
" :name, " +
" '$(targetTableName)', " +
" 'I', " +
" $(triggerHistoryId), " +
Expand All @@ -74,20 +74,20 @@ public InterbaseTriggerTemplate(ISymmetricDialect symmetricDialect) {

sqlTemplates.put("updateTriggerTemplate" ,
"create trigger $(triggerName) for $(schemaName)$(tableName) after update as " +
" declare variable id integer; " +
" declare variable name integer; " +
" declare variable sync_triggers_disabled varchar(30); " +
" declare variable sync_node_disabled varchar(30); " +
" begin " +
" select context_value from $(prefixName)_context where id = 'sync_triggers_disabled' into :sync_triggers_disabled; " +
" select context_value from $(prefixName)_context where name = 'sync_triggers_disabled' into :sync_triggers_disabled; " +
" $(custom_before_update_text) \n" +
" if ($(syncOnUpdateCondition) and $(syncOnIncomingBatchCondition)) then " +
" begin " +
" select context_value from $(prefixName)_context where id = 'sync_node_disabled' into :sync_node_disabled; " +
" select gen_id($(defaultSchema)GEN_$(prefixName)_data_data_id, 1) from rdb$database into :id; " +
" select context_value from $(prefixName)_context where name = 'sync_node_disabled' into :sync_node_disabled; " +
" select gen_id($(defaultSchema)GEN_$(prefixName)_data_data_id, 1) from rdb$database into :name; " +
" insert into $(defaultSchema)$(prefixName)_data " +
" (data_id, table_name, event_type, trigger_hist_id, pk_data, row_data, old_data, channel_id, transaction_id, source_node_id, external_data, create_time) " +
" values( " +
" :id, " +
" :name, " +
" '$(targetTableName)', " +
" 'U', " +
" $(triggerHistoryId), " +
Expand All @@ -106,20 +106,20 @@ public InterbaseTriggerTemplate(ISymmetricDialect symmetricDialect) {

sqlTemplates.put("deleteTriggerTemplate" ,
"create trigger $(triggerName) for $(schemaName)$(tableName) after delete as " +
" declare variable id integer; " +
" declare variable name integer; " +
" declare variable sync_triggers_disabled varchar(30); " +
" declare variable sync_node_disabled varchar(30); " +
" begin " +
" select context_value from $(prefixName)_context where id = 'sync_triggers_disabled' into :sync_triggers_disabled; " +
" select context_value from $(prefixName)_context where name = 'sync_triggers_disabled' into :sync_triggers_disabled; " +
" $(custom_before_delete_text) \n" +
" if ($(syncOnDeleteCondition) and $(syncOnIncomingBatchCondition)) then " +
" begin " +
" select context_value from $(prefixName)_context where id = 'sync_node_disabled' into :sync_node_disabled; " +
" select gen_id($(defaultSchema)GEN_$(prefixName)_data_data_id, 1) from rdb$database into :id; " +
" select context_value from $(prefixName)_context where name = 'sync_node_disabled' into :sync_node_disabled; " +
" select gen_id($(defaultSchema)GEN_$(prefixName)_data_data_id, 1) from rdb$database into :name; " +
" insert into $(defaultSchema)$(prefixName)_data " +
" (data_id, table_name, event_type, trigger_hist_id, pk_data, old_data, channel_id, transaction_id, source_node_id, external_data, create_time) " +
" values( " +
" :id, " +
" :name, " +
" '$(targetTableName)', " +
" 'D', " +
" $(triggerHistoryId), " +
Expand Down

0 comments on commit fd50a9b

Please sign in to comment.