All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jumpmind.symmetric.db.firebird.xml Maven / Gradle / Ivy

Go to download

SymmetricDS is an open source database synchronization solution. It is platform-independent, web-enabled, and database-agnostic. SymmetricDS was first built to replicate changes between 'retail store' databases and ad centralized 'corporate' database.

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" default-lazy-init="true">

    <bean id="firebirdDialect" class="org.jumpmind.symmetric.db.firebird.FirebirdDbDialect"
        scope="prototype">
        <property name="tablePrefix" value="$[sym.sync.table.prefix]" />
        <property name="parameterService" ref="parameterService" />
        <property name="defaultSchema" value="$[sym.db.default.schema]" />
        <property name="streamingResultsFetchSize" value="$[sym.db.jdbc.streaming.results.fetch.size]" />
        <property name="sqlTemplate">
            <bean class="org.jumpmind.symmetric.db.SqlTemplate">
                
                <property name="functionInstalledSql">
                    <value>
                        <![CDATA[select count(*) from rdb$functions where rdb$function_name = upper('$(functionName)')]]>
                    </value>
                </property>               
                <property name="functionTemplatesToInstall">
                    <map>
                        <entry key="escape">
                            <value>
                                declare external function $(functionName) cstring(32660)
                                returns cstring(32660) free_it entry_point 'sym_escape' module_name 'sym_udf'
                            </value>
                        </entry>
                        <entry key="hex">
                            <value>
                                declare external function $(functionName) blob
                                returns cstring(32660) free_it entry_point 'sym_hex' module_name 'sym_udf'
                            </value>
                        </entry>
                    </map>
                </property>                                   
                <property name="stringColumnTemplate" >
                    <value>
                        <![CDATA[case when $(tableAlias).$(columnName) is null then '' else '"' || $[sym.sync.table.prefix]_escape(substring($(tableAlias).$(columnName) from 1)) || '"' end ||','||]]>
                    </value>
                </property>
                <property name="clobColumnTemplate">
                    <value>
                        <![CDATA[case when $(tableAlias).$(columnName) is null then '' else '"' || $[sym.sync.table.prefix]_escape(substring($(tableAlias).$(columnName) from 1)) || '"' end ||','||]]>
                    </value>
                </property>
                <property name="blobColumnTemplate">
                    <value>
                        <![CDATA[case when $(tableAlias).$(columnName) is null then '' else '"' || $[sym.sync.table.prefix]_hex($(tableAlias).$(columnName)) || '"' end ||','||]]>
                    </value>
                </property>
                <property name="numberColumnTemplate">
                    <value>
                        <![CDATA[case when $(tableAlias).$(columnName) is null then '' else '"' || $(tableAlias).$(columnName) || '"' end ||','||]]>
                    </value>
                </property>
                <property name="datetimeColumnTemplate" >
                    <value>
                        <![CDATA[case when $(tableAlias).$(columnName) is null then '' else '"' || $(tableAlias).$(columnName) || '"' end ||','||]]>
                    </value>
                </property>
                <property name="triggerConcatCharacter" value="||"/>
                <property name="newTriggerValue" value="new"/>
                <property name="oldTriggerValue" value="old"/>
                <property name="sqlTemplates">
                    <map>
                        <entry key="insertTriggerTemplate">
                            <value>
                                <![CDATA[
                                create trigger $(triggerName) for $(schemaName)$(tableName) after insert as
                                declare variable id bigint;
                                begin
                                  if ($(syncOnInsertCondition) and $(syncOnIncomingBatchCondition)) then
                                  begin
                                    select gen_id($(defaultSchema)gen_$(prefixName)_data_data_id, 1) from rdb$database into :id;
                                    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,
                                      '$(targetTableName)',
                                      'I',
                                      $(triggerHistoryId),
                                      $(columns),       
                                      '$(channelName)',          
                                      $(txIdExpression),
                                      rdb$get_context('USER_SESSION', 'sync_node_disabled'),
                                      $(externalSelect),                         
                                      CURRENT_TIMESTAMP
                                    );
                                  end
                                end
                                ]]>
                            </value>
                        </entry>
                        <entry key="updateTriggerTemplate">
                            <value>
                                <![CDATA[
                                create trigger $(triggerName) for $(schemaName)$(tableName) after update as
                                declare variable id bigint;
                                begin
                                  if ($(syncOnUpdateCondition) and $(syncOnIncomingBatchCondition)) then
                                  begin
                                    select gen_id($(defaultSchema)gen_$(prefixName)_data_data_id, 1) from rdb$database into :id;
                                    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,
                                      '$(targetTableName)',
                                      'U',
                                      $(triggerHistoryId),
                                      $(oldKeys),
                                      $(columns),
                                      $(oldColumns),       
                                      '$(channelName)',          
                                      $(txIdExpression),
                                      rdb$get_context('USER_SESSION', 'sync_node_disabled'),
                                      $(externalSelect),  
                                      CURRENT_TIMESTAMP
                                    );
                                  end
                                end
                                ]]>
                            </value>
                        </entry>
                        <entry key="deleteTriggerTemplate">
                            <value>
                                <![CDATA[
                                create trigger  $(triggerName) for $(schemaName)$(tableName) after delete as
                                declare variable id bigint;
                                begin
                                  if ($(syncOnDeleteCondition) and $(syncOnIncomingBatchCondition)) then
                                  begin
                                    select gen_id($(defaultSchema)gen_$(prefixName)_data_data_id, 1) from rdb$database into :id;
                                    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,
                                      '$(targetTableName)',
                                      'D',
                                      $(triggerHistoryId),
                                      $(oldKeys),                                      
                                      $(oldColumns),       
                                      '$(channelName)',          
                                      $(txIdExpression),
                                      rdb$get_context('USER_SESSION', 'sync_node_disabled'), 
                                      $(externalSelect), 
                                      CURRENT_TIMESTAMP
                                    );
                                  end
                                end
                                ]]>
                            </value>
                        </entry>
                        <entry key="initialLoadSqlTemplate">
                            <value>
                                <![CDATA[select $(columns) from $(schemaName)$(tableName) t where $(whereClause)]]>
                            </value>
                        </entry>
                    </map>
                </property>
            </bean>
        </property>
    </bean>

</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy